mm_expand 2.0.9 → 2.1.1
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/lib/base.js +14 -6
- package/package.json +1 -1
package/lib/base.js
CHANGED
|
@@ -52,17 +52,18 @@ Base.prototype.log = function (level, message, ...params) {
|
|
|
52
52
|
Base.prototype._initListen = function () {
|
|
53
53
|
let status_last = 'created';
|
|
54
54
|
// 初始化
|
|
55
|
-
this.on('init:before', (ctx) => {
|
|
55
|
+
this.on('init:before', async (ctx) => {
|
|
56
56
|
this.status = 'initing';
|
|
57
|
-
this._initCore(...ctx.params);
|
|
57
|
+
await this._initCore(...ctx.params);
|
|
58
58
|
});
|
|
59
59
|
this.on('init:after', (ctx) => {
|
|
60
60
|
this.status = 'inited';
|
|
61
61
|
});
|
|
62
62
|
// 销毁
|
|
63
|
-
this.on('destroy:before', (ctx) => {
|
|
63
|
+
this.on('destroy:before', async (ctx) => {
|
|
64
64
|
status_last = this.status;
|
|
65
65
|
this.status = 'destroying';
|
|
66
|
+
await this._destroyCore(...ctx.params);
|
|
66
67
|
});
|
|
67
68
|
this.on('destroy:success', (ctx) => {
|
|
68
69
|
this.status = 'destroyed';
|
|
@@ -93,7 +94,6 @@ Base.prototype.setConfig = function (config) {
|
|
|
93
94
|
* @returns {object} 返回当前对象
|
|
94
95
|
*/
|
|
95
96
|
Base.prototype._initCore = async function (...params) {
|
|
96
|
-
this.status = 'init';
|
|
97
97
|
return this;
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -106,11 +106,19 @@ Base.prototype.init = async function (...params) {
|
|
|
106
106
|
return this;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* 销毁核心
|
|
111
|
+
* @returns {object} 返回当前对象
|
|
112
|
+
*/
|
|
113
|
+
Base.prototype._destroyCore = async function () {
|
|
114
|
+
return this;
|
|
115
|
+
};
|
|
116
|
+
|
|
109
117
|
/**
|
|
110
118
|
* 销毁
|
|
111
119
|
*/
|
|
112
120
|
Base.prototype.destroy = async function () {
|
|
113
|
-
|
|
121
|
+
return this;
|
|
114
122
|
};
|
|
115
123
|
|
|
116
124
|
/**
|
|
@@ -151,7 +159,7 @@ Base.prototype._do = async function (method, ...params) {
|
|
|
151
159
|
try {
|
|
152
160
|
await this._doBeforeProcess(method, ctx);
|
|
153
161
|
if (ctx.cancelled) {
|
|
154
|
-
return ctx
|
|
162
|
+
return ctx;
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
await this._doExecuteMethod(method, ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_expand",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Super Meimei Prototype Function Extension Module - Enhanced operations for string, array, object, date manipulation with error prevention and simplified business logic.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|