From c0106e941b72a0b9b377ca124649c5f5e13f2262 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Tue, 5 Nov 2019 17:02:58 +0800 Subject: [PATCH] feat: support async task Signed-off-by: MiaoWoo --- packages/core/package.json | 3 ++- packages/core/src/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 515d2c5c..c535837c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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" } -} +} \ No newline at end of file diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 48634d30..93b4daf3 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -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() {