mm_expand 2.1.0 → 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.
Files changed (2) hide show
  1. package/lib/base.js +13 -5
  2. 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
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "2.1.0",
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": {