feat: optimize api

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-09-19 18:59:00 +08:00
parent dfa43d58f0
commit 15cea1dfc8
6 changed files with 23 additions and 23 deletions

View File

@@ -98,15 +98,15 @@ export namespace event {
/**
* 添加事件监听
* @param jsp
* @param plugin
* @param event
* @param exec {function}
* @param priority [LOWEST,LOW,NORMAL,HIGH,HIGHEST,MONITOR]
* @param ignoreCancel
*/
listen(jsp, event, exec, priority, ignoreCancel) {
if (!jsp || !jsp.description || !jsp.description.name) throw new TypeError('插件名称为空 请检查传入参数!');
var name = jsp.description.name;
listen(plugin, event, exec, priority = 'NORMAL', ignoreCancel = false) {
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError('插件名称为空 请检查传入参数!');
var name = plugin.description.name;
var eventCls = this.name2Class(name, event);
if (!eventCls) { return; }
if (typeof priority === 'boolean') {