node-pluggable
Advanced tools
Comparing version 0.1.0 to 0.1.1
18
index.js
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var _, async, pluggable, | ||
var EventEmitter, _, async, pluggable, | ||
slice = [].slice; | ||
@@ -10,4 +10,6 @@ | ||
pluggable = {}; | ||
EventEmitter = require('events').EventEmitter; | ||
pluggable = new EventEmitter(); | ||
pluggable.stack = []; | ||
@@ -59,3 +61,3 @@ | ||
pluggable.on = function() { | ||
pluggable.run = function() { | ||
var callback, i, match_param, params; | ||
@@ -74,2 +76,12 @@ match_param = arguments[0], params = 3 <= arguments.length ? slice.call(arguments, 1, i = arguments.length - 1) : (i = 1, []), callback = arguments[i++]; | ||
pluggable.bind = function() { | ||
var fn, fns, i, len, match_param; | ||
match_param = arguments[0], fns = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
for (i = 0, len = fns.length; i < len; i++) { | ||
fn = fns[i]; | ||
pluggable.on(match_param, fn); | ||
} | ||
return pluggable; | ||
}; | ||
module.exports = pluggable; | ||
@@ -76,0 +88,0 @@ |
{ | ||
"name": "node-pluggable", | ||
"version": "0.1.0", | ||
"description": "hook", | ||
"version": "0.1.1", | ||
"description": "Add your Hook more easily.", | ||
"main": "index.js", | ||
@@ -14,4 +14,5 @@ "repository": { | ||
"async": "^0.9.0", | ||
"eventproxy": "^0.3.2", | ||
"underscore": "^1.8.2" | ||
} | ||
} |
@@ -31,5 +31,13 @@ ## node-pluggable | ||
pluggable.on 'article.create', article, -> | ||
pluggable.run 'article.create', article, -> | ||
console.log article | ||
pluggable.bind 'article.update', (article) -> | ||
console.log article | ||
, (article) -> | ||
console.log article.length | ||
pluggable.emit 'article.update', 'just a message.' | ||
### License | ||
@@ -36,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
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
4918
75
52
3
+ Addedeventproxy@^0.3.2
+ Addeddebug@2.2.0(transitive)
+ Addedeventproxy@0.3.5(transitive)
+ Addedms@0.7.1(transitive)