Permalink
Browse files

Renaming from events to eventify

  • Loading branch information...
1 parent 9f4d326 commit f27d3bf407ab608e4343abf8f28ac43ec4c7a879 @bermi committed May 17, 2012
Showing with 99 additions and 102 deletions.
  1. +1 −1 .gitignore
  2. +0 −4 HISTORY.md
  3. +19 −19 README.md
  4. +7 −0 dist/eventify.min.js
  5. +0 −7 dist/events.min.js
  6. +4 −4 grunt.js
  7. +1 −2 lib/ender.js
  8. +25 −25 lib/{events.js → eventify.js}
  9. +1 −1 lib/index.js
  10. +8 −6 package.json
  11. +4 −4 test/browser-dist.html
  12. +4 −4 test/browser.html
  13. +25 −25 test/{events.test.js → eventify.test.js}
View
@@ -2,5 +2,5 @@
node_modules
npm-debug.log
test/coverage.html
-dist/events.js
+dist/eventify.js
lib-cov
View
@@ -1,4 +0,0 @@
-0.0.1 / 2012-05-04
-==================
-
- * Initial release
View
@@ -1,37 +1,37 @@
-# events
+# Eventify
-[![Build Status](https://secure.travis-ci.org/bermi/events.png)](http://travis-ci.org/bermi/events)
+[![Build Status](https://secure.travis-ci.org/bermi/evemtify.png)](http://travis-ci.org/bermi/eventify)
-Events is a lightweight module that can be mixed in to any object in order to provide it with custom events. It has no external dependencies. Based on Backbone.Events
+Eventify is a lightweight module that can be mixed in to any object in order to provide it with custom events. It has no external dependencies. Based on Backbone.Events
## Installing
### On the browser
A 1.6k (830 bytes gzipped) browser ready version is available on the dist/ folder.
- <script src="/dist/events.min.js" type="text/javascript"></script>
+ <script src="/dist/eventify.min.js" type="text/javascript"></script>
### Node.js
- $ npm install events
+ $ npm install eventify
### Ender support
- ender add events
+ ender add eventify
-Will provide access to an Events instance on $.events and will expose the $.eventize function;
+Will provide access to the $.eventify function
## Documentation
-Events is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Events do not have to be declared before they are bound, and may take passed arguments. For example:
+Eventify is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events. Events do not have to be declared before they are bound, and may take passed arguments. For example:
var object = {};
- Events.eventize(object);
+ Eventify.create(object);
object.on("alert", function(msg) {
alert("Triggered " + msg);
@@ -40,13 +40,13 @@ Events is a module that can be mixed in to any object, giving the object the abi
object.trigger("alert", "an event");
-### *eventize* Events.eventize(destination)
+### *create* Eventify.create(destination)
Copies the methods on, off and trigger to the destination object, and returns the destination object.
For example, to make a handy event dispatcher that can coordinate events among different areas of your application:
- var dispatcher = Events.eventize()
+ var dispatcher = Eventify.create()
### *on* object.on(event, callback, [context])
@@ -88,20 +88,20 @@ Remove a previously-bound callback function from an object. If no context is spe
Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.
-### *noClonflict* var LocalEvents = Events.noConflict();
+### *noClonflict* var LocalEventify = Eventify.noConflict();
-Returns the Events object back to its original value. You can use the return value of Events.noConflict() to keep a local reference to Events. Useful for embedding Events on third-party websites, where you don't want to clobber the existing Events object.
+Returns the Eventify object back to its original value. You can use the return value of Eventify.noConflict() to keep a local reference to Eventify. Useful for embedding Eventify on third-party websites, where you don't want to clobber the existing Eventify object.
- var localEvents = Events.noConflict();
- var model = localEvents.eventize();
+ var localEventify = Eventify.noConflict();
+ var model = localEventify.create();
-Another option is to bind the Events library to the window object using a different name. You can do so by declaring the localEventsLibraryName before loading the events library code. For example:
+Another option is to bind the Eventify library to the window object using a different name. You can do so by declaring the localEventifyLibraryName before loading the Eventify library code. For example:
- <script>var localEventsLibraryName = 'EventManager';</script>
- <script src="/dist/events.min.js" type="text/javascript"></script>
+ <script>var localEventifyLibraryName = 'EventManager';</script>
+ <script src="/dist/eventify.min.js" type="text/javascript"></script>
<script>
- var dispatcher = EventManager.eventize();
+ var dispatcher = EventManager.create();
</script>
@@ -0,0 +1,7 @@
+// eventify - v0.2.1 (2012-05-17)
+// -----------------
+// Copyright(c) 2010-2012 Jeremy Ashkenas, DocumentCloud
+// Copyright(c) 2012 Bermi Ferrer <bermi@bermilabs.com>
+// MIT Licensed
+
+(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);
View
@@ -1,7 +0,0 @@
-// events - v0.1.3 (2012-05-17)
-// -----------------
-// Copyright(c) 2010-2012 Jeremy Ashkenas, DocumentCloud
-// Copyright(c) 2012 Bermi Ferrer <bermi@bermilabs.com>
-// MIT Licensed
-
-(function(a){"use strict";var b,c=a.Events,d=/\s+/,e=a.localEventsLibraryName||"Events",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.1.3",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.Events=c,this},eventize: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);
View
@@ -52,14 +52,14 @@ module.exports = function (grunt) {
},
concat: {
dist: {
- src: ['lib/events.js'],
- dest: 'dist/events.js'
+ src: ['lib/eventify.js'],
+ dest: 'dist/eventify.js'
}
},
min: {
dist: {
- src: ['<banner>', 'dist/events.js'],
- dest: 'dist/events.min.js'
+ src: ['<banner>', 'dist/eventify.js'],
+ dest: 'dist/eventify.min.js'
}
}
});
View
@@ -1,7 +1,6 @@
(function ($) {
var Events = require('events');
$.ender({
- events: Events,
- eventize: Events.eventize
+ eventify: Events.create
});
}(ender));
@@ -1,4 +1,4 @@
-// Events
+// Eventify
// -----------------
// Copyright(c) 2010-2012 Jeremy Ashkenas, DocumentCloud
// Copyright(c) 2012 Bermi Ferrer <bermi@bermilabs.com>
@@ -10,28 +10,28 @@
// to an event; trigger`-ing an event fires all callbacks in succession.
//
// var object = {};
-// Events.eventize(object);
+// Eventify.create(object);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
(function (root) {
'use strict';
- // Events, based on Backbone.Events
+ // Eventify, based on Backbone.Events
// -----------------
- var EventsInstance,
- // Save the previous value of the `Events` variable.
- previousEvents = root.Events,
+ var EventifyInstance,
+ // Save the previous value of the `Eventify` variable.
+ previousEventify = root.Eventify,
// Regular expression used to split event strings
eventSplitter = /\s+/,
- // Defines the name of the local variable the Events library will use
- // this is specially useful if window.Events is already being used
+ // Defines the name of the local variable the Eventify library will use
+ // this is specially useful if window.Eventify is already being used
// by your application and you want a different name. For example:
- // // Decare before including the events library
- // var localEventsLibraryName = 'EventManager';
- localName = root.localEventsLibraryName || "Events",
+ // // Decare before including the Eventify library
+ // var localEventifyLibraryName = 'EventManager';
+ localName = root.localEventifyLibraryName || "Eventify",
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
@@ -48,14 +48,14 @@
return keys;
},
- // Create a safe reference to the Events object for use below.
- Events = function (options) {
+ // Create a safe reference to the Eventify object for use below.
+ Eventify = function (options) {
return this;
};
- Events.prototype = {
+ Eventify.prototype = {
- version: "0.1.3",
+ version: "0.2.1",
// Event Functions
// -----------------
@@ -174,16 +174,16 @@
// Utility Functions
// -----------------
- // Run Events in *noConflict* mode, returning the `Events`
+ // Run Eventify in *noConflict* mode, returning the `Eventify`
// variable to its previous owner. Returns a reference to
- // the Events object.
+ // the Eventify object.
noConflict: function () {
- root.Events = previousEvents;
+ root.Eventify = previousEventify;
return this;
},
// Adds the methods on, off and trigger to a target Object
- eventize: function (target) {
+ create: function (target) {
var i, len,
methods = ['on', 'off', 'trigger'];
target = target || {};
@@ -196,16 +196,16 @@
};
- // Export an Events instance for **Node.js**, with
+ // Export an Eventify instance for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
- // the browser, add `Events` as a global object via a string identifier,
+ // the browser, add `Eventify` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
- EventsInstance = new Events();
- // Sets Events on the browser window or on the process
- ((typeof exports !== 'undefined') ? exports : root)[localName] = new Events();
+ EventifyInstance = new Eventify();
+ // Sets Eventify on the browser window or on the process
+ ((typeof exports !== 'undefined') ? exports : root)[localName] = new Eventify();
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
- module.exports = new Events();
+ module.exports = new Eventify();
}
}
View
@@ -3,5 +3,5 @@
// Copyright(c) 2012 Bermi Ferrer <bermi@bermilabs.com>
// MIT Licensed
-module.exports = require('./events');
+module.exports = require('./eventify');
View
@@ -1,10 +1,12 @@
{
- "name": "events",
- "version": "0.1.3",
- "description": "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",
+ "name": "eventify",
+ "version": "0.2.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",
"author": "Bermi Ferrer <bermi@bermilabs.com>",
"keywords": [
"event",
+ "eventify",
+ "events",
"browser",
"trigger",
"observer",
@@ -13,7 +15,7 @@
"ender"
],
"bugs": {
- "url": "https://github.com/bermi/events/issues"
+ "url": "https://github.com/bermi/eventify/issues"
},
"licenses": [
{
@@ -24,7 +26,7 @@
"repositories": [
{
"type": "git",
- "url": "git://github.com/bermi/events.git"
+ "url": "git://github.com/bermi/eventify.git"
}
],
"engines": {
@@ -41,5 +43,5 @@
"test": "make test"
},
"ender": "./lib/ender.js",
- "main": "./lib/events.js"
+ "main": "./lib/eventify.js"
}
@@ -1,16 +1,16 @@
<html>
<head>
<meta charset="utf-8">
- <title>Events Tests</title>
+ <title>Eventify Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" type="text/css" charset="utf-8">
<script src="../node_modules/mocha/mocha.js" type="text/javascript" charset="utf-8"></script>
<script src="../node_modules/expect.js/expect.js" type="text/javascript" charset="utf-8"></script>
<script>mocha.setup('bdd')</script>
<script type="text/javascript">
- var Events = "original";
+ var Eventify = "original";
</script>
- <script src="../dist/events.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="events.test.js"></script>
+ <script src="../dist/eventify.min.js" type="text/javascript" charset="utf-8"></script>
+ <script src="eventify.test.js"></script>
</head>
<body>
<div id="mocha"></div>
View
@@ -1,16 +1,16 @@
<html>
<head>
<meta charset="utf-8">
- <title>Events Tests</title>
+ <title>Eventify Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" type="text/css" charset="utf-8">
<script src="../node_modules/mocha/mocha.js" type="text/javascript" charset="utf-8"></script>
<script src="../node_modules/expect.js/expect.js" type="text/javascript" charset="utf-8"></script>
<script>mocha.setup('bdd')</script>
<script type="text/javascript">
- var Events = "original";
+ var Eventify = "original";
</script>
- <script src="../lib/events.js" type="text/javascript" charset="utf-8"></script>
- <script src="events.test.js"></script>
+ <script src="../lib/eventify.js" type="text/javascript" charset="utf-8"></script>
+ <script src="eventify.test.js"></script>
</head>
<body>
<div id="mocha"></div>
Oops, something went wrong.

0 comments on commit f27d3bf

Please sign in to comment.