feat: support async task

Signed-off-by: MiaoWoo <admin@yumc.pw>
clean
MiaoWoo 2019-11-05 17:02:58 +08:00
parent b87b94aade
commit 55a6b33110
2 changed files with 4 additions and 3 deletions

View File

@ -12,6 +12,7 @@
"homepage": "https://github.com/circlecloud/ms.git",
"license": "ISC",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"publishConfig": {
"registry": "https://repo.yumc.pw/repository/npm-hosted/"
},
@ -34,4 +35,4 @@
"@ms/plugin": "^0.1.1",
"@ms/sponge": "^0.1.1"
}
}
}

View File

@ -37,9 +37,9 @@ class MiaoScriptCore {
loadTaskFunction() {
//@ts-ignore
global.setTimeout = (func: Function, tick: number) => this.taskManager.create(func).later(tick).submit()
global.setTimeout = (func: Function, tick: number, async: boolean = false) => this.taskManager.create(func).later(tick).async(async).submit()
//@ts-ignore
global.setInterval = (func: Function, tick: number) => this.taskManager.create(func).timer(tick).submit()
global.setInterval = (func: Function, tick: number, async: boolean = false) => this.taskManager.create(func).timer(tick).async(async).submit()
}
loadPlugins() {