Permalink
Browse files

Adding support for ender, removed pkginfo dependency

  • Loading branch information...
1 parent 7c0a3b6 commit b17cbf9a214957aca7168d5c98c9c31d80f0e4c7 @bermi committed May 17, 2012
Showing with 33 additions and 16 deletions.
  1. +1 −1 Makefile
  2. +12 −5 README.md
  3. +2 −2 dist/events.min.js
  4. +2 −1 grunt.js
  5. +7 −0 lib/ender.js
  6. +2 −0 lib/events.js
  7. +0 −2 lib/index.js
  8. +6 −4 package.json
  9. +1 −1 test/events.test.js
View
@@ -43,4 +43,4 @@ docclean:
clean: docclean test-clean-instrument test-watch test
-.PHONY: test test-cov docclean dev docclean
+.PHONY: test test-coverage docclean dev docclean test-clean-instrument test-instrument
View
@@ -16,13 +16,20 @@ A 1.6k (830 bytes gzipped) browser ready version is available on the dist/ folde
$ npm install events
+### Ender support
+
+ ender add events
+
+Will provide access to an Events instance on $.events and will expose the $.eventize 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:
var object = {};
- Events.eventify(object);
+ Events.eventize(object);
object.on("alert", function(msg) {
alert("Triggered " + msg);
@@ -31,13 +38,13 @@ Events is a module that can be mixed in to any object, giving the object the abi
object.trigger("alert", "an event");
-### *eventify* Events.eventify(destination)
+### *eventize* Events.eventize(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.eventify()
+ var dispatcher = Events.eventize()
### *on* object.on(event, callback, [context])
@@ -84,15 +91,15 @@ Trigger callbacks for the given event, or space-delimited list of events. Subseq
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.
var localEvents = Events.noConflict();
- var model = localEvents.eventify();
+ var model = localEvents.eventize();
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:
<script>var localEventsLibraryName = 'EventManager';</script>
<script src="/dist/events.min.js" type="text/javascript"></script>
<script>
- var dispatcher = EventManager.eventify();
+ var dispatcher = EventManager.eventize();
</script>
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -37,7 +37,8 @@ module.exports = function (grunt) {
describe: true,
expect: true,
it: true,
- before: true
+ before: true,
+ ender: true
}
},
pkg: '<json:package.json>',
View
@@ -0,0 +1,7 @@
+(function ($) {
+ var Events = require('events');
+ $.ender({
+ events: Events,
+ eventize: Events.eventize
+ });
+}(ender));
View
@@ -55,6 +55,8 @@
Events.prototype = {
+ version: "0.1.3",
+
// Event Functions
// -----------------
View
@@ -5,5 +5,3 @@
module.exports = require('./events');
-// Version
-require('pkginfo')(module, 'version');
View
@@ -1,6 +1,6 @@
{
"name": "events",
- "version": "0.1.1",
+ "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",
"author": "Bermi Ferrer <bermi@bermilabs.com>",
"keywords": [
@@ -9,7 +9,8 @@
"trigger",
"observer",
"bind",
- "backbone"
+ "backbone",
+ "ender"
],
"bugs": {
"url": "https://github.com/bermi/events/issues"
@@ -30,7 +31,6 @@
"node": "0.6.x"
},
"dependencies": {
- "pkginfo": "0.2.x"
},
"devDependencies": {
"mocha": "1.0.x",
@@ -39,5 +39,7 @@
},
"scripts": {
"test": "make test"
- }
+ },
+ "ender": "./lib/ender.js",
+ "main": "./lib/events.js"
}
View
@@ -5,7 +5,7 @@
if (typeof window === 'undefined') {
root.Events = "original";
- Events = require('../');
+ Events = require('../index.js');
} else {
Events = root.Events;
}

0 comments on commit b17cbf9

Please sign in to comment.