mirror of
https://github.com/fuse-friends/fuse-native
synced 2025-06-13 12:53:54 +00:00
Standardized
This commit is contained in:
parent
8fb3334d7a
commit
b9d24f6812
7
index.js
7
index.js
@ -156,13 +156,18 @@ function wrapSafe (ops, timeout) {
|
|||||||
const cb = arguments[arguments.length - 1]
|
const cb = arguments[arguments.length - 1]
|
||||||
var called = false
|
var called = false
|
||||||
|
|
||||||
|
if (destroyed) {
|
||||||
|
if (!called) return cb(exports.EIO)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const idx = pending.indexOf(null)
|
const idx = pending.indexOf(null)
|
||||||
|
|
||||||
const cbInfo = { cb, tick: 0 }
|
const cbInfo = { cb, tick: 0 }
|
||||||
pending[idx === -1 ? pending.length : idx] = cbInfo
|
pending[idx === -1 ? pending.length : idx] = cbInfo
|
||||||
|
|
||||||
try {
|
try {
|
||||||
op.apply(null, [...Array.prototype.slice.call(arguments, 0, -1), safeCb])
|
op(...[...Array.prototype.slice.call(arguments, 0, -1), safeCb])
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!cb[TIMED_OUT] && !called) return cb(exports.EIO)
|
if (!cb[TIMED_OUT] && !called) return cb(exports.EIO)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user