mirror of
https://github.com/fuse-friends/fuse-native
synced 2024-10-27 18:34:01 +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]
|
||||
var called = false
|
||||
|
||||
if (destroyed) {
|
||||
if (!called) return cb(exports.EIO)
|
||||
return
|
||||
}
|
||||
|
||||
const idx = pending.indexOf(null)
|
||||
|
||||
const cbInfo = { cb, tick: 0 }
|
||||
pending[idx === -1 ? pending.length : idx] = cbInfo
|
||||
|
||||
try {
|
||||
op.apply(null, [...Array.prototype.slice.call(arguments, 0, -1), safeCb])
|
||||
op(...[...Array.prototype.slice.call(arguments, 0, -1), safeCb])
|
||||
} catch (err) {
|
||||
if (!cb[TIMED_OUT] && !called) return cb(exports.EIO)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user