angular-es-utils
Advanced tools
Comparing version 1.2.22 to 1.2.23
@@ -32,3 +32,3 @@ 'use strict'; | ||
descriptor.set = function (value) { | ||
target[name] = value; | ||
this[fnName] = value; | ||
}; | ||
@@ -35,0 +35,0 @@ |
@@ -38,3 +38,3 @@ 'use strict'; | ||
// 可清除指定监听器,如果不传则清除对应topic全部监听器 | ||
function unSubscribe(listener) { | ||
function deregister(listener) { | ||
@@ -57,3 +57,3 @@ var listenerIndex; | ||
// scope销毁时同步移除对应订阅行为 | ||
scope.$on('$destroy', unSubscribe.bind(null, listener)); | ||
scope.$on('$destroy', deregister.bind(null, listener)); | ||
} | ||
@@ -63,3 +63,3 @@ | ||
return unSubscribe; | ||
return deregister; | ||
}, | ||
@@ -66,0 +66,0 @@ |
{ | ||
"name": "angular-es-utils", | ||
"version": "1.2.22", | ||
"version": "1.2.23", | ||
"description": "es utils design for angular1.x", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -47,5 +47,15 @@ ## angular-es-utils | ||
* mediator | ||
中介者,环境无关的 订阅/发布 模型 | ||
* EventBus | ||
事件总线,环境无关的 订阅/发布 模型 | ||
```js | ||
import EventBus from 'angular-es-utils/event-bus'; | ||
// 订阅消息 | ||
const deregister = EventBus.on('grid:click', (num1,num2,num3) => console.log(num1, num2, num3)); | ||
// 发布消息 | ||
EventBus.dispatch('grid:click', 1, 2, 3); | ||
// 解除订阅 | ||
deregister(); | ||
``` | ||
* module-helper | ||
@@ -52,0 +62,0 @@ |
21093
66