Comparing version 0.2.1 to 0.2.2
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.6.1 | ||
@@ -12,3 +12,3 @@ /* | ||
(function() { | ||
var Channel, airwaves, remove, split, | ||
var Channel, airwaves, remove, split, subscribe, | ||
__slice = [].slice, | ||
@@ -48,2 +48,18 @@ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
subscribe = function(propertyName) { | ||
return function(names, fn) { | ||
var name, _i, _len; | ||
for (_i = 0, _len = names.length; _i < _len; _i++) { | ||
name = names[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(this.subscriptions, name)) { | ||
this.subscriptions[name] = { | ||
ints: [], | ||
subs: [] | ||
}; | ||
} | ||
this.subscriptions[name][propertyName].push(fn); | ||
} | ||
}; | ||
}; | ||
Channel = (function() { | ||
@@ -56,23 +72,5 @@ | ||
Channel.prototype.intercept = split(function(names, fn) { | ||
var n, _base, _i, _len; | ||
for (_i = 0, _len = names.length; _i < _len; _i++) { | ||
n = names[_i]; | ||
((_base = this.subscriptions)[n] || (_base[n] = { | ||
ints: [], | ||
subs: [] | ||
})).ints.push(fn); | ||
} | ||
}); | ||
Channel.prototype.intercept = split(subscribe('ints')); | ||
Channel.prototype.subscribe = split(function(names, fn) { | ||
var n, _base, _i, _len; | ||
for (_i = 0, _len = names.length; _i < _len; _i++) { | ||
n = names[_i]; | ||
((_base = this.subscriptions)[n] || (_base[n] = { | ||
ints: [], | ||
subs: [] | ||
})).subs.push(fn); | ||
} | ||
}); | ||
Channel.prototype.subscribe = split(subscribe('subs')); | ||
@@ -144,3 +142,3 @@ Channel.prototype.unsubscribe = split(function(names, fn) { | ||
Channel: Channel, | ||
version: '0.2.1' | ||
version: '0.2.2' | ||
}; | ||
@@ -147,0 +145,0 @@ |
{ | ||
"name": "airwaves", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": "David Chambers <dc@hashify.me>", | ||
@@ -9,9 +9,9 @@ "keywords": ["pubsub", "publish", "subscribe", "broadcast", "message"], | ||
"type": "git", | ||
"url": "https://github.com/davidchambers/airwaves" | ||
"url": "git://github.com/davidchambers/airwaves.git" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "1.4.x", | ||
"mocha": "1.7.x", | ||
"coffee-script": "1.6.x", | ||
"mocha": "1.8.x", | ||
"should": "1.2.x" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
18187
130