Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "uevents.js", | ||
"main": "uevents.js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/acornejo/uevents.js", | ||
@@ -6,0 +6,0 @@ "authors": [ |
{ | ||
"name": "uevents.js", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Alex Cornejo", | ||
@@ -5,0 +5,0 @@ "main": "uevents.js", |
@@ -21,3 +21,3 @@ # uevents.js | ||
// create new uevents object | ||
var obj = new uevents(); | ||
var obj = uevents.create(); | ||
@@ -52,3 +52,3 @@ // register callback for signal receiving two parmeters | ||
uevents.extend(obj); | ||
uevents.create(obj); | ||
@@ -55,0 +55,0 @@ // register callback for 'signal' |
@@ -27,3 +27,3 @@ (function () { | ||
obj.on = uevents.on.bind(data); | ||
obj.once = uevents.once.bind(data); | ||
obj.once = uevents.once.bind(obj); | ||
obj.off = uevents.off.bind(data); | ||
@@ -92,3 +92,3 @@ obj.trigger = uevents.trigger.bind(data); | ||
self.off(name, once); | ||
callback.apply(context || this, arguments); | ||
callback.apply(context || self, arguments); | ||
}; | ||
@@ -177,5 +177,5 @@ return this.on(name, once, context); | ||
else if (typeof define === "function" && define.amd) | ||
define(["uevents"], function () { return uevents; }); | ||
define(function () { return uevents; }); | ||
else | ||
window.uevents = uevents; | ||
})(); |
@@ -1,1 +0,1 @@ | ||
(function(){var uevents={create:function(obj){if(typeof obj==="undefined"){var self=Object.create(this);self._events={};return self}else{var data={_events:{}};obj.on=uevents.on.bind(data);obj.once=uevents.once.bind(data);obj.off=uevents.off.bind(data);obj.trigger=uevents.trigger.bind(data);return obj}},on:function(name,callback,context){if(!this._events.hasOwnProperty(name))this._events[name]=[];this._events[name].push([callback,context]);return this},once:function(name,callback,context){var self=this,once=function(){self.off(name,once);callback.apply(context||this,arguments)};return this.on(name,once,context)},off:function(name,callback,context){if(!name){this._events={}}else if(this._events.hasOwnProperty(name)){if(!callback&&!context){delete this._events[name]}else{var event=this._events[name],filtered=[];for(var i=0,len=event.length;i<len;i++){if((!callback||event[i][0]!==callback)&&(!context||event[i][1]===context))filtered.push(event[i])}if(!filtered.length)delete this._events[name];else this._events[name]=filtered}}return this},trigger:function(name){if(this._events.hasOwnProperty(name)){var args=Array.prototype.slice.call(arguments,1),callbacks=this._events[name],len=callbacks.length;for(var i=0;i<len;i++){var callback=callbacks[i][0],context=callbacks[i][1];callback.apply(context||this,args)}}}};if(typeof require==="function"&&typeof exports==="object"&&typeof module==="object")module.exports=uevents;else if(typeof define==="function"&&define.amd)define(["uevents"],function(){return uevents});else window.uevents=uevents})(); | ||
(function(){var uevents={create:function(obj){if(typeof obj==="undefined"){var self=Object.create(this);self._events={};return self}else{var data={_events:{}};obj.on=uevents.on.bind(data);obj.once=uevents.once.bind(obj);obj.off=uevents.off.bind(data);obj.trigger=uevents.trigger.bind(data);return obj}},on:function(name,callback,context){if(!this._events.hasOwnProperty(name))this._events[name]=[];this._events[name].push([callback,context]);return this},once:function(name,callback,context){var self=this,once=function(){self.off(name,once);callback.apply(context||self,arguments)};return this.on(name,once,context)},off:function(name,callback,context){if(!name){this._events={}}else if(this._events.hasOwnProperty(name)){if(!callback&&!context){delete this._events[name]}else{var event=this._events[name],filtered=[];for(var i=0,len=event.length;i<len;i++){if((!callback||event[i][0]!==callback)&&(!context||event[i][1]===context))filtered.push(event[i])}if(!filtered.length)delete this._events[name];else this._events[name]=filtered}}return this},trigger:function(name){if(this._events.hasOwnProperty(name)){var args=Array.prototype.slice.call(arguments,1),callbacks=this._events[name],len=callbacks.length;for(var i=0;i<len;i++){var callback=callbacks[i][0],context=callbacks[i][1];callback.apply(context||this,args)}}}};if(typeof require==="function"&&typeof exports==="object"&&typeof module==="object")module.exports=uevents;else if(typeof define==="function"&&define.amd)define(function(){return uevents});else window.uevents=uevents})(); |
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
17210