@yumerijs/core 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +2 -1
- package/dist/context.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Core } from './core';
|
|
7
7
|
import { Route } from './route';
|
|
8
8
|
import { HookHandler } from './hook';
|
|
9
|
+
import { Middleware } from './middleware';
|
|
9
10
|
/**
|
|
10
11
|
* 插件上下文对象
|
|
11
12
|
* 每个插件一个 Context,用于管理插件注册的命令、路由、事件、组件和中间件
|
|
@@ -44,7 +45,7 @@ export declare class Context {
|
|
|
44
45
|
* @param name 中间件名称
|
|
45
46
|
* @param callback 中间件回调函数
|
|
46
47
|
*/
|
|
47
|
-
use(name: string, callback:
|
|
48
|
+
use(name: string, callback: Middleware): void;
|
|
48
49
|
/**
|
|
49
50
|
* 注册 Hook 钩子
|
|
50
51
|
* @param name Hook 点名称
|
package/dist/context.js
CHANGED
|
@@ -57,7 +57,7 @@ class Context {
|
|
|
57
57
|
*/
|
|
58
58
|
use(name, callback) {
|
|
59
59
|
this.middlewares.push(name);
|
|
60
|
-
this.core.use(name,
|
|
60
|
+
this.core.use(name, callback);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* 注册 Hook 钩子
|
|
@@ -141,7 +141,7 @@ class Context {
|
|
|
141
141
|
});
|
|
142
142
|
// 删除钩子
|
|
143
143
|
for (const hook in this.hooks) {
|
|
144
|
-
this.hooks
|
|
144
|
+
this.hooks[hook].forEach((hookname) => {
|
|
145
145
|
this.core.unhook(hook, hookname);
|
|
146
146
|
});
|
|
147
147
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED