mm_expand 1.7.2 → 1.7.4
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/index.js +23 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -511,13 +511,13 @@ Eventer.prototype.on = function(key, func) {
|
|
|
511
511
|
* @param {String} key 事件关键
|
|
512
512
|
* @param {Object} params 传递参数
|
|
513
513
|
*/
|
|
514
|
-
Eventer.prototype.run = function(key, params) {
|
|
514
|
+
Eventer.prototype.run = function(key, ...params) {
|
|
515
515
|
var events = this.dict;
|
|
516
516
|
var list = events[key];
|
|
517
517
|
if (list) {
|
|
518
518
|
for (var i = 0; i < list.length; i++) {
|
|
519
519
|
try {
|
|
520
|
-
list[i](params);
|
|
520
|
+
list[i](...params);
|
|
521
521
|
} catch (e) {
|
|
522
522
|
console.error(e);
|
|
523
523
|
//TODO handle the exception
|
|
@@ -2278,6 +2278,27 @@ if (typeof($) === "undefined") {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
return newArr;
|
|
2280
2280
|
};
|
|
2281
|
+
|
|
2282
|
+
/**
|
|
2283
|
+
* 在数组指定位置插入对象
|
|
2284
|
+
* @param {Number} index 索引位置
|
|
2285
|
+
* @param {Object} obj 插入对象
|
|
2286
|
+
*/
|
|
2287
|
+
Array.prototype.insert = function(index, obj) {
|
|
2288
|
+
this.splice(index, 0, obj);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* 在数组指定位置插入数组的对象
|
|
2293
|
+
* @param {Number} index 索引位置
|
|
2294
|
+
* @param {Array} list 插入的对象数组
|
|
2295
|
+
*/
|
|
2296
|
+
Array.prototype.insertList = function(index, list) {
|
|
2297
|
+
for (var i = 0; i < list.length; i++) {
|
|
2298
|
+
var obj = list[i];
|
|
2299
|
+
this.insert(index, obj);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2281
2302
|
})();
|
|
2282
2303
|
|
|
2283
2304
|
/**
|