ms/packages/plugin/src/task.ts
MiaoWoo d769a9c8ca fix: task disable error
Signed-off-by: MiaoWoo <admin@yumc.pw>
2020-11-13 09:40:34 +08:00

17 lines
445 B
TypeScript

import { plugin, task } from '@ccms/api'
import { provideSingleton, Autowired } from '@ccms/container'
@provideSingleton(PluginTaskManager)
export class PluginTaskManager {
@Autowired()
private taskManager: task.TaskManager
constructor() {
process.on('plugin.after.disable', this.cancelTask.bind(this))
}
private cancelTask(pluginInstance: plugin.Plugin) {
this.taskManager.disable(pluginInstance)
}
}