Comparing version 0.1.1-0 to 0.2.0
@@ -122,7 +122,24 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.axons=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function mkDef(api) { | ||
return function (definition) { | ||
return definition(api); | ||
} | ||
} | ||
return { | ||
publish: publish, | ||
subscribe: subscribe, | ||
unsubscribe: unsubscribe, | ||
filter: filter, | ||
define: { | ||
publisher: mkDef({ | ||
publish: publish, | ||
promises: q | ||
}), | ||
subscriber: mkDef({ | ||
subscribe: subscribe, | ||
unsubscribe: unsubscribe, | ||
promises: q | ||
}), | ||
filter: mkDef({ | ||
filter: filter, | ||
promises: q | ||
}) | ||
}, | ||
forwardTo: forwardTo, | ||
@@ -129,0 +146,0 @@ dropForward: dropForward, |
@@ -1,5 +0,5 @@ | ||
// axons v0.1.0 | ||
// axons v0.1.1-0 | ||
// license:MIT | ||
// naugtur@gmail.com | ||
// built 2014-12-14 | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.axons=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a){if("object"==typeof a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}}function d(a){var b=a.split("#");return{to:b[0],hash:b[1]}}function e(){function a(a,b){var c=d(a);m[c.to]||(m[c.to]=[]),m[c.to].push({hash:c.hash,func:b})}function b(a){var b=d(a);b.hash?m[b.to]=m[b.to].filter(function(a){return a.hash!==b.hash}):m[b.to]&&m[b.to].length>0&&(m[b.to]=[])}function e(a,b){var e=d(a);return f(!0).then(function(){var a=b?c(b):{},d=f(a);return n[e.to]&&n[e.to].length>0&&n[e.to].forEach(function(a,b){d=d.then(b)}),d}).then(function(c){var d=[];m[e.to]&&m[e.to].length>0&&(d=d.concat(m[e.to].filter(function(a){return!a.hash||a.hash===e.hash}).map(function(a){return a.func(c)})));for(var g in o)d.push(o[g].publish(a,b));return f.all(d)})}function h(a,b){n[a]||(n[a]=[]),n[a].push(b)}function i(a){a.name!==l&&(o[a.name]=a)}function j(a){a.name!==l&&delete o[a.name]}function k(){m={},n={},o={}}var l=g++,m={},n={},o={};return{publish:e,subscribe:a,unsubscribe:b,filter:h,forwardTo:i,dropForward:j,name:l,destroy:k}}var f=a(2),g=0,h=e();b.exports={promises:f,newChannel:e,global:h}},{}],2:[function(a,b){function c(a,b){a.forEach(function(a,c){a.then(function(a){b(c,{state:"fulfilled",value:a})},function(a){b(c,{state:"rejected",reason:a})})})}var d=a(3),e=function(a){return a.fail=function(b){return a.then(0,b)},a},f=function(a){var b=d(e);return b(a),b};f.defer=function(){var a=d(e);return{promise:a,resolve:function(b){a(!0,[b])},reject:function(b){a(!1,[b])}}},f.all=function(a){var b=f.defer(),d=[],e=a.length;return c(a,function(a,c){e&&("rejected"===c.state?(e=0,b.reject(c.reason)):(d[a]=c,0===--e&&b.resolve(d)))}),b.promise},f.allSettled=function(a){var b=f.defer(),d=[],e=a.length;return c(a,function(a,c){d[a]=c,0===--e&&b.resolve(d)}),b.promise},b.exports=f},{}],3:[function(a,b){!function(a){function b(a){return"function"==typeof a}function c(a){return"object"==typeof a}function d(a){"undefined"!=typeof setImmediate?setImmediate(a):"undefined"!=typeof process&&process.nextTick?process.nextTick(a):setTimeout(a,0)}var e;a[0][a[1]]=function f(a){var g,h=[],i=[],j=function(a,b){return null==g&&null!=a&&(g=a,h=b,i.length&&d(function(){for(var a=0;a<i.length;a++)i[a]()})),g};return j.then=function(j,k){var l=f(a),m=function(){function a(d){var f,g=0;try{if(d&&(c(d)||b(d))&&b(f=d.then)){if(d===l)throw new TypeError;f.call(d,function(){g++||a.apply(e,arguments)},function(a){g++||l(!1,[a])})}else l(!0,arguments)}catch(h){g++||l(!1,[h])}}try{var d=g?j:k;b(d)?a(d.apply(e,h||[])):l(g,h)}catch(f){l(!1,[f])}};return null!=g?d(m):i.push(m),l},a&&(j=a(j)),j}}("undefined"==typeof b?[window,"pinkySwear"]:[b,"exports"])},{}]},{},[1])(1)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.axons=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a){if("object"==typeof a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}}function d(a){var b=a.split("#");return{to:b[0],hash:b[1]}}function e(){function a(a,b){var c=d(a);n[c.to]||(n[c.to]=[]),n[c.to].push({hash:c.hash,func:b})}function b(a){var b=d(a);b.hash?n[b.to]=n[b.to].filter(function(a){return a.hash!==b.hash}):n[b.to]&&n[b.to].length>0&&(n[b.to]=[])}function e(a,b){var e=d(a);return f(!0).then(function(){var a=b?c(b):{},d=f(a);return o[e.to]&&o[e.to].length>0&&o[e.to].forEach(function(a,b){d=d.then(b)}),d}).then(function(c){var d=[];n[e.to]&&n[e.to].length>0&&(d=d.concat(n[e.to].filter(function(a){return!a.hash||a.hash===e.hash}).map(function(a){return a.func(c)})));for(var g in p)d.push(p[g].publish(a,b));return f.all(d)})}function h(a,b){o[a]||(o[a]=[]),o[a].push(b)}function i(a){a.name!==m&&(p[a.name]=a)}function j(a){a.name!==m&&delete p[a.name]}function k(){n={},o={},p={}}function l(a){return function(b){return b(a)}}var m=g++,n={},o={},p={};return{define:{publisher:l({publish:e,promises:f}),subscriber:l({subscribe:a,unsubscribe:b,promises:f}),filter:l({filter:h,promises:f})},forwardTo:i,dropForward:j,name:m,destroy:k}}var f=a(2),g=0,h=e();b.exports={promises:f,newChannel:e,global:h}},{}],2:[function(a,b){function c(a,b){a.forEach(function(a,c){a.then(function(a){b(c,{state:"fulfilled",value:a})},function(a){b(c,{state:"rejected",reason:a})})})}var d=a(3),e=function(a){return a.fail=function(b){return a.then(0,b)},a},f=function(a){var b=d(e);return b(a),b};f.defer=function(){var a=d(e);return{promise:a,resolve:function(b){a(!0,[b])},reject:function(b){a(!1,[b])}}},f.all=function(a){var b=f.defer(),d=[],e=a.length;return c(a,function(a,c){e&&("rejected"===c.state?(e=0,b.reject(c.reason)):(d[a]=c,0===--e&&b.resolve(d)))}),b.promise},f.allSettled=function(a){var b=f.defer(),d=[],e=a.length;return c(a,function(a,c){d[a]=c,0===--e&&b.resolve(d)}),b.promise},b.exports=f},{}],3:[function(a,b){!function(a){function b(a){return"function"==typeof a}function c(a){return"object"==typeof a}function d(a){"undefined"!=typeof setImmediate?setImmediate(a):"undefined"!=typeof process&&process.nextTick?process.nextTick(a):setTimeout(a,0)}var e;a[0][a[1]]=function f(a){var g,h=[],i=[],j=function(a,b){return null==g&&null!=a&&(g=a,h=b,i.length&&d(function(){for(var a=0;a<i.length;a++)i[a]()})),g};return j.then=function(j,k){var l=f(a),m=function(){function a(d){var f,g=0;try{if(d&&(c(d)||b(d))&&b(f=d.then)){if(d===l)throw new TypeError;f.call(d,function(){g++||a.apply(e,arguments)},function(a){g++||l(!1,[a])})}else l(!0,arguments)}catch(h){g++||l(!1,[h])}}try{var d=g?j:k;b(d)?a(d.apply(e,h||[])):l(g,h)}catch(f){l(!1,[f])}};return null!=g?d(m):i.push(m),l},a&&(j=a(j)),j}}("undefined"==typeof b?[window,"pinkySwear"]:[b,"exports"])},{}]},{},[1])(1)}); |
25
index.js
@@ -121,7 +121,24 @@ var q = require('q'); | ||
function mkDef(api) { | ||
return function (definition) { | ||
return definition(api); | ||
} | ||
} | ||
return { | ||
publish: publish, | ||
subscribe: subscribe, | ||
unsubscribe: unsubscribe, | ||
filter: filter, | ||
define: { | ||
publisher: mkDef({ | ||
publish: publish, | ||
promises: q | ||
}), | ||
subscriber: mkDef({ | ||
subscribe: subscribe, | ||
unsubscribe: unsubscribe, | ||
promises: q | ||
}), | ||
filter: mkDef({ | ||
filter: filter, | ||
promises: q | ||
}) | ||
}, | ||
forwardTo: forwardTo, | ||
@@ -128,0 +145,0 @@ dropForward: dropForward, |
{ | ||
"name": "axons", | ||
"version": "0.1.1-0", | ||
"version": "0.2.0", | ||
"description": "A communication channel you always wanted instead of pub-sub", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
24361
584