fix: task disable error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-11-13 09:40:34 +08:00
parent c64d167893
commit d769a9c8ca
11 changed files with 122 additions and 70 deletions

View File

@ -22,6 +22,19 @@ class Process extends EventEmitter {
}
}
platform = Packages.java.lang.System.getProperty("os.name")
on(event: string | symbol, listener: (...args: any[]) => void) {
return super.on(event, (...args) => {
try {
listener(...args)
} catch (error) {
try {
super.emit('error', error)
} catch (error) {
console.ex(error)
}
}
})
}
nextTick(func: Function) {
microTaskPool.execute(func)
}