feat: support async task

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-11-05 17:02:58 +08:00
parent 736760b2ee
commit c0106e941b
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -37,9 +37,9 @@ class MiaoScriptCore {
loadTaskFunction() { loadTaskFunction() {
//@ts-ignore //@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 //@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() { loadPlugins() {