eventdispatcher
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -18,2 +18,8 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.EventDispatcher = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
this._destroyed = false; | ||
//Method Map | ||
this.on = this.bind = this.addEventListener = this.addListener; | ||
this.off = this.unbind = this.removeEventListener = this.removeListener; | ||
this.once = this.one = this.addListenerOnce; | ||
this.emmit = this.trigger = this.dispatchEvent = this.dispatch; | ||
}; | ||
@@ -122,9 +128,2 @@ | ||
//Method Map | ||
EventDispatcher.prototype.on = EventDispatcher.prototype.bind = EventDispatcher.prototype.addEventListener = EventDispatcher.prototype.addListener; | ||
EventDispatcher.prototype.off = EventDispatcher.prototype.unbind = EventDispatcher.prototype.removeEventListener = EventDispatcher.prototype.removeListener; | ||
EventDispatcher.prototype.once = EventDispatcher.prototype.one = EventDispatcher.prototype.addListenerOnce; | ||
EventDispatcher.prototype.trigger = EventDispatcher.prototype.dispatchEvent = EventDispatcher.prototype.dispatch; | ||
module.exports = EventDispatcher; | ||
@@ -134,2 +133,2 @@ | ||
}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZG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biAgIHZhciByZXN1bHQgPSB0aGlzLl9ldmVudE1hcCA/IHRoaXMuX2V2ZW50TWFwW2V2ZW50XSA6IG51bGw7XG4gICByZXR1cm4gKHJlc3VsdCB8fCBudWxsKTtcbiB9O1xuXG4gRXZlbnREaXNwYXRjaGVyLnByb3RvdHlwZS5kZXN0cm95ID0gZnVuY3Rpb24oKSB7XG4gICBpZiAodGhpcy5fZXZlbnRNYXApIHtcbiAgICAgZm9yICh2YXIgaSBpbiB0aGlzLl9ldmVudE1hcCkge1xuICAgICAgIHRoaXMucmVtb3ZlQWxsTGlzdGVuZXIoaSk7XG4gICAgIH1cbiAgICAgdGhpcy5fZXZlbnRNYXAgPSBudWxsO1xuICAgfVxuICAgdGhpcy5fZGVzdHJveWVkID0gdHJ1ZTtcbiB9O1xuXG4gbW9kdWxlLmV4cG9ydHMgPSBFdmVudERpc3BhdGNoZXI7XG4iXX0= |
@@ -1,1 +0,1 @@ | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.EventDispatcher=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";function isEmpty(obj){for(var prop in obj)if(obj.hasOwnProperty(prop))return!1;return!0}var _instanceMap={},EventDispatcher=function(){this._eventMap={},this._destroyed=!1};EventDispatcher.getInstance=function(key){if(!key)throw new Error("key must be");return _instanceMap[key]||(_instanceMap[key]=new EventDispatcher)},EventDispatcher.prototype.addListener=function(event,listener){var listeners=this.getListener(event);return listeners?-1===listeners.indexOf(listener)?(listeners.push(listener),!0):!1:(this._eventMap[event]=[listener],!0)},EventDispatcher.prototype.addListenerOnce=function(event,listener){var s=this,f2=function(){return s.removeListener(event,f2),listener.apply(this,arguments)};return this.addListener(event,f2)},EventDispatcher.prototype.removeListener=function(event,listener){if("undefined"==typeof listener)return this.removeAllListener(event);var listeners=this.getListener(event);if(listeners){var i=listeners.indexOf(listener);if(i>-1)return listeners=listeners.splice(i,1),listeners.length||delete this._eventMap[event],!0}return!1},EventDispatcher.prototype.removeAllListener=function(event){var listeners=this.getListener(event);return listeners?(this._eventMap[event].length=0,delete this._eventMap[event],!0):!1},EventDispatcher.prototype.hasListener=function(event){return null!==this.getListener(event)},EventDispatcher.prototype.hasListeners=function(){return null!==this._eventMap&&void 0!==this._eventMap&&!isEmpty(this._eventMap)},EventDispatcher.prototype.dispatch=function(eventType,eventObject){var listeners=this.getListener(eventType);if(listeners){eventObject=eventObject||{},eventObject.type=eventType,eventObject.target=eventObject.target||this;for(var i=-1;++i<listeners.length;)listeners[i](eventObject);return!0}return!1},EventDispatcher.prototype.getListener=function(event){var result=this._eventMap?this._eventMap[event]:null;return result||null},EventDispatcher.prototype.destroy=function(){if(this._eventMap){for(var i in this._eventMap)this.removeAllListener(i);this._eventMap=null}this._destroyed=!0},EventDispatcher.prototype.on=EventDispatcher.prototype.bind=EventDispatcher.prototype.addEventListener=EventDispatcher.prototype.addListener,EventDispatcher.prototype.off=EventDispatcher.prototype.unbind=EventDispatcher.prototype.removeEventListener=EventDispatcher.prototype.removeListener,EventDispatcher.prototype.once=EventDispatcher.prototype.one=EventDispatcher.prototype.addListenerOnce,EventDispatcher.prototype.trigger=EventDispatcher.prototype.dispatchEvent=EventDispatcher.prototype.dispatch,module.exports=EventDispatcher},{}]},{},[1])(1)}); | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.EventDispatcher=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";function isEmpty(obj){for(var prop in obj)if(obj.hasOwnProperty(prop))return!1;return!0}var _instanceMap={},EventDispatcher=function(){this._eventMap={},this._destroyed=!1,this.on=this.bind=this.addEventListener=this.addListener,this.off=this.unbind=this.removeEventListener=this.removeListener,this.once=this.one=this.addListenerOnce,this.emmit=this.trigger=this.dispatchEvent=this.dispatch};EventDispatcher.getInstance=function(key){if(!key)throw new Error("key must be");return _instanceMap[key]||(_instanceMap[key]=new EventDispatcher)},EventDispatcher.prototype.addListener=function(event,listener){var listeners=this.getListener(event);return listeners?-1===listeners.indexOf(listener)?(listeners.push(listener),!0):!1:(this._eventMap[event]=[listener],!0)},EventDispatcher.prototype.addListenerOnce=function(event,listener){var s=this,f2=function(){return s.removeListener(event,f2),listener.apply(this,arguments)};return this.addListener(event,f2)},EventDispatcher.prototype.removeListener=function(event,listener){if("undefined"==typeof listener)return this.removeAllListener(event);var listeners=this.getListener(event);if(listeners){var i=listeners.indexOf(listener);if(i>-1)return listeners=listeners.splice(i,1),listeners.length||delete this._eventMap[event],!0}return!1},EventDispatcher.prototype.removeAllListener=function(event){var listeners=this.getListener(event);return listeners?(this._eventMap[event].length=0,delete this._eventMap[event],!0):!1},EventDispatcher.prototype.hasListener=function(event){return null!==this.getListener(event)},EventDispatcher.prototype.hasListeners=function(){return null!==this._eventMap&&void 0!==this._eventMap&&!isEmpty(this._eventMap)},EventDispatcher.prototype.dispatch=function(eventType,eventObject){var listeners=this.getListener(eventType);if(listeners){eventObject=eventObject||{},eventObject.type=eventType,eventObject.target=eventObject.target||this;for(var i=-1;++i<listeners.length;)listeners[i](eventObject);return!0}return!1},EventDispatcher.prototype.getListener=function(event){var result=this._eventMap?this._eventMap[event]:null;return result||null},EventDispatcher.prototype.destroy=function(){if(this._eventMap){for(var i in this._eventMap)this.removeAllListener(i);this._eventMap=null}this._destroyed=!0},module.exports=EventDispatcher},{}]},{},[1])(1)}); |
{ | ||
"name": "eventdispatcher", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "EventDispatcher like nodes EventEmitter", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -17,2 +17,8 @@ 'use strict'; | ||
this._destroyed = false; | ||
//Method Map | ||
this.on = this.bind = this.addEventListener = this.addListener; | ||
this.off = this.unbind = this.removeEventListener = this.removeListener; | ||
this.once = this.one = this.addListenerOnce; | ||
this.emmit = this.trigger = this.dispatchEvent = this.dispatch; | ||
}; | ||
@@ -121,9 +127,2 @@ | ||
//Method Map | ||
EventDispatcher.prototype.on = EventDispatcher.prototype.bind = EventDispatcher.prototype.addEventListener = EventDispatcher.prototype.addListener; | ||
EventDispatcher.prototype.off = EventDispatcher.prototype.unbind = EventDispatcher.prototype.removeEventListener = EventDispatcher.prototype.removeListener; | ||
EventDispatcher.prototype.once = EventDispatcher.prototype.one = EventDispatcher.prototype.addListenerOnce; | ||
EventDispatcher.prototype.trigger = EventDispatcher.prototype.dispatchEvent = EventDispatcher.prototype.dispatch; | ||
module.exports = EventDispatcher; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23284
305