Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eventify

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventify - npm Package Compare versions

Comparing version 0.2.1 to 0.3.1

4

dist/eventify.min.js

@@ -1,2 +0,2 @@

// eventify - v0.2.1 (2012-05-17)
// eventify - v0.3.1 (2012-05-17)
// -----------------

@@ -7,2 +7,2 @@ // Copyright(c) 2010-2012 Jeremy Ashkenas, DocumentCloud

(function(a){"use strict";var b,c=a.Eventify,d=/\s+/,e=a.localEventifyLibraryName||"Eventify",f=Object.keys||function(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("keys() called on a non-object");var b,c=[];for(b in a)a.hasOwnProperty(b)&&(c[c.length]=b);return c},g=function(a){return this};g.prototype={version:"0.2.1",on:function(a,b,c){var e,f,g;if(!b)return this;a=a.split(d),e=this._callbacks||(this._callbacks={}),f=a.shift();while(f)g=e[f]||(e[f]=[]),g.push(b,c),f=a.shift();return this},off:function(a,b,c){var e,g,h,i;if(!(g=this._callbacks))return this;if(!(a||b||c))return delete this._callbacks,this;a?a=a.split(d):a=f(g),e=a.shift();while(e){if(!(h=g[e])||!b&&!c){delete g[e],e=a.shift();continue}for(i=h.length-2;i>=0;i-=2)b&&h[i]!==b||c&&h[i+1]!==c||h.splice(i,2);e=a.shift()}return this},trigger:function(a){var b,c,e,f,g,h,i,j;if(!(c=this._callbacks))return this;j=[],a=a.split(d);for(f=1,g=arguments.length;f<g;f=f+1)j[f-1]=arguments[f];b=a.shift();while(b){i=c.all,i&&(i=i.slice()),e=c[b],e&&(e=e.slice());if(e)for(f=0,g=e.length;f<g;f+=2)e[f].apply(e[f+1]||this,j);if(i){h=[b].concat(j);for(f=0,g=i.length;f<g;f+=2)i[f].apply(i[f+1]||this,h)}b=a.shift()}return this},noConflict:function(){return a.Eventify=c,this},create:function(a){var b,c,d=["on","off","trigger"];a=a||{};for(b=0,c=d.length;b<c;b=b+1)a[d[b]]=this[d[b]];return a}},b=new g,(typeof exports!="undefined"?exports:a)[e]=new g,typeof exports!="undefined"&&typeof module!="undefined"&&module.exports&&(module.exports=new g)})(this);
(function(a){"use strict";var b,c=a.Eventify,d=/\s+/,e=a.localEventifyLibraryName||"Eventify",f=Object.keys||function(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("keys() called on a non-object");var b,c=[];for(b in a)a.hasOwnProperty(b)&&(c[c.length]=b);return c},g=function(a){return this};g.prototype={version:"0.3.1",on:function(a,b,c){var e,f,g;if(!b)return this;a=a.split(d),e=this._callbacks||(this._callbacks={}),f=a.shift();while(f)g=e[f]||(e[f]=[]),g.push(b,c),f=a.shift();return this},off:function(a,b,c){var e,g,h,i;if(!(g=this._callbacks))return this;if(!(a||b||c))return delete this._callbacks,this;a?a=a.split(d):a=f(g),e=a.shift();while(e){if(!(h=g[e])||!b&&!c){delete g[e],e=a.shift();continue}for(i=h.length-2;i>=0;i-=2)b&&h[i]!==b||c&&h[i+1]!==c||h.splice(i,2);e=a.shift()}return this},trigger:function(a){var b,c,e,f,g,h,i,j;if(!(c=this._callbacks))return this;j=[],a=a.split(d);for(f=1,g=arguments.length;f<g;f=f+1)j[f-1]=arguments[f];b=a.shift();while(b){i=c.all,i&&(i=i.slice()),e=c[b],e&&(e=e.slice());if(e)for(f=0,g=e.length;f<g;f+=2)e[f].apply(e[f+1]||this,j);if(i){h=[b].concat(j);for(f=0,g=i.length;f<g;f+=2)i[f].apply(i[f+1]||this,h)}b=a.shift()}return this},noConflict:function(){return a.Eventify=c,this},enable:function(a){var b,c,d=["on","off","trigger"];a=a||{};for(b=0,c=d.length;b<c;b=b+1)a[d[b]]=this[d[b]];return a}},b=new g,(typeof exports!="undefined"?exports:a)[e]=new g,typeof exports!="undefined"&&typeof module!="undefined"&&module.exports&&(module.exports=new g)})(this);
(function ($) {
var Events = require('events');
$.ender({
eventify: Events.create
eventify: Events.enable
});
}(ender));

@@ -13,3 +13,3 @@ // Eventify

// var object = {};
// Eventify.create(object);
// Eventify.enable(object);
// object.on('expand', function(){ alert('expanded'); });

@@ -59,3 +59,3 @@ // object.trigger('expand');

version: "0.2.1",
version: "0.3.1",

@@ -188,3 +188,3 @@ // Event Functions

// Adds the methods on, off and trigger to a target Object
create: function (target) {
enable: function (target) {
var i, len,

@@ -191,0 +191,0 @@ methods = ['on', 'off', 'trigger'];

{
"name": "eventify",
"version": "0.2.1",
"version": "0.3.1",
"description": "Lightweight module that can be mixed in to any object in order to provide it with custom events. For node.js and the browser. Based on Backbone.Events",

@@ -5,0 +5,0 @@ "author": "Bermi Ferrer <bermi@bermilabs.com>",

@@ -34,3 +34,3 @@ # Eventify

Eventify.create(object);
Eventify.enable(object);

@@ -44,3 +44,3 @@ object.on("alert", function(msg) {

### *create* Eventify.create(destination)
### *enable* Eventify.enable(destination)

@@ -51,3 +51,3 @@ Copies the methods on, off and trigger to the destination object, and returns the destination object.

var dispatcher = Eventify.create()
var dispatcher = Eventify.enable()

@@ -99,3 +99,3 @@

var localEventify = Eventify.noConflict();
var model = localEventify.create();
var model = localEventify.enable();

@@ -108,3 +108,3 @@

<script>
var dispatcher = EventManager.create();
var dispatcher = EventManager.enable();
</script>

@@ -111,0 +111,0 @@

@@ -26,3 +26,3 @@ (function (root) {

var obj = { counter: 0 };
Eventify.create(obj);
Eventify.enable(obj);
it('should increment counter', function () {

@@ -44,3 +44,3 @@ obj.on('event', function () { obj.counter += 1; });

var obj = { counter: 0 };
Eventify.create(obj);
Eventify.enable(obj);

@@ -66,3 +66,3 @@ obj.on('a b c', function () { obj.counter += 1; });

var a, b, obj = { counter: 0 };
Eventify.create(obj);
Eventify.enable(obj);
obj.on('all', function (event) {

@@ -88,3 +88,3 @@ obj.counter = obj.counter + 1;

obj = { counter: 0 };
Eventify.create(obj);
Eventify.enable(obj);
callback = function () { obj.counter = obj.counter + 1; };

@@ -103,3 +103,3 @@ obj.on('event', callback);

obj = { counterA: 0, counterB: 0 };
Eventify.create(obj);
Eventify.enable(obj);
callback = function () { obj.counterA = obj.counterA + 1; };

@@ -122,3 +122,3 @@ obj.on('event', callback);

obj = {counter: 0};
Eventify.create(obj);
Eventify.enable(obj);
callback = function () {

@@ -139,3 +139,3 @@ obj.counter = obj.counter + 1;

var obj = { counterA: 0, counterB: 0 };
Eventify.create(obj);
Eventify.enable(obj);
function incrA() {

@@ -172,3 +172,3 @@ obj.counterA = obj.counterA + 1;

};
obj = Eventify.create();
obj = Eventify.enable();
obj.on('event', function () {

@@ -183,3 +183,3 @@ this.assertTrue();

var obj = { counter: 0 };
Eventify.create(obj);
Eventify.enable(obj);
function incr1() {

@@ -205,3 +205,3 @@ obj.counter = obj.counter + 1;

var counter = 0,
obj = Eventify.create();
obj = Eventify.enable();
function incr() {

@@ -231,3 +231,3 @@ counter = counter + 1;

var counter = 0,
obj = Eventify.create();
obj = Eventify.enable();
function incr() {

@@ -246,3 +246,3 @@ counter = counter + 1;

describe("if no callback is provided, `on` is a noop", function () {
Eventify.create().on('test').trigger('test');
Eventify.enable().on('test').trigger('test');
});

@@ -252,3 +252,3 @@

it("should remove context", function (done) {
var obj = Eventify.create();
var obj = Eventify.enable();
obj.on('x y all', function () {

@@ -268,3 +268,3 @@ expect(true).to.be(true);

it("should remove callback", function (done) {
var obj = Eventify.create();
var obj = Eventify.enable();
function success() {

@@ -286,3 +286,3 @@ expect(true).to.be(true);

it("should be chainable", function () {
var obj = Eventify.create();
var obj = Eventify.enable();
// With no events

@@ -301,3 +301,3 @@ expect(obj.off() === obj).to.be(true);

it("should not skip", function (done) {
var obj = Eventify.create();
var obj = Eventify.enable();
obj.on('event', function () { expect(true).to.be(false); }, obj);

@@ -313,3 +313,3 @@ obj.on('event', function () { expect(true).to.be(false); }, obj);

it("should include aditional parameters", function (done) {
var obj = Eventify.create(),
var obj = Eventify.enable(),
param1 = "one",

@@ -316,0 +316,0 @@ param2 = ["two"];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc