Comparing version 0.1.14 to 0.1.15
{ | ||
"name": "reflux", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"homepage": "https://github.com/spoike/reflux", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -237,8 +237,10 @@ !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.Reflux=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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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(_dereq_,module,exports){ | ||
hasListener: function(listenable) { | ||
var i = 0, | ||
listener; | ||
var i = 0, j, listener, listenables; | ||
for (;i < (this.subscriptions||[]).length; ++i) { | ||
listener = this.subscriptions[i].listenable; | ||
if (listener === listenable || listener.hasListener && listener.hasListener(listenable)) { | ||
return true; | ||
listenables = [].concat(this.subscriptions[i].listenable); | ||
for (j = 0; j < listenables.length; j++){ | ||
listener = listenables[j]; | ||
if (listener === listenable || listener.hasListener && listener.hasListener(listenable)) { | ||
return true; | ||
} | ||
} | ||
@@ -366,2 +368,3 @@ } | ||
* @param {Function|String} callback The method to call when all publishers have emitted | ||
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables | ||
*/ | ||
@@ -375,2 +378,3 @@ joinTrailing: maker("last"), | ||
* @param {Function|String} callback The method to call when all publishers have emitted | ||
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables | ||
*/ | ||
@@ -384,2 +388,3 @@ joinLeading: maker("first"), | ||
* @param {Function|String} callback The method to call when all publishers have emitted | ||
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables | ||
*/ | ||
@@ -393,2 +398,3 @@ joinConcat: maker("all"), | ||
* @param {Function|String} callback The method to call when all publishers have emitted | ||
* @returns {Object} A subscription obj where `stop` is an unsub function and `listenable` is an array of listenables | ||
*/ | ||
@@ -668,2 +674,3 @@ joinStrict: maker("strict"), | ||
var slice = Array.prototype.slice, | ||
_ = _dereq_("./utils"), | ||
createStore = _dereq_("./createStore"), | ||
@@ -700,2 +707,3 @@ strategyMethodNames = { | ||
return function(/* listenables..., callback*/){ | ||
_.throwIf(arguments.length < 3,'Cannot create a join with less than 2 listenables!'); | ||
var listenables = slice.call(arguments), | ||
@@ -709,7 +717,14 @@ callback = listenables.pop(), | ||
strategy: strategy | ||
}; | ||
for (var i = 0; i < numberOfListenables; i++) { | ||
this.listenTo(listenables[i],newListener(i,join)); | ||
}, i, cancels = [], subobj; | ||
for (i = 0; i < numberOfListenables; i++) { | ||
_.throwIf(this.validateListening(listenables[i])); | ||
} | ||
for (i = 0; i < numberOfListenables; i++) { | ||
cancels.push(listenables[i].listen(newListener(i,join),this)); | ||
} | ||
reset(join); | ||
subobj = {listenable: listenables}; | ||
subobj.stop = makeStopper(subobj,cancels,this); | ||
this.subscriptions = (this.subscriptions || []).concat(subobj); | ||
return subobj; | ||
}; | ||
@@ -720,2 +735,14 @@ }; | ||
function makeStopper(subobj,cancels,context){ | ||
return function() { | ||
var i, subs = context.subscriptions; | ||
index = (subs ? subs.indexOf(subobj) : -1); | ||
_.throwIf(index === -1,'Tried to remove join already gone from subscriptions list!'); | ||
for(i=0;i < cancels.length; i++){ | ||
cancels[i](); | ||
} | ||
subs.splice(index, 1); | ||
}; | ||
} | ||
function reset(join) { | ||
@@ -753,3 +780,3 @@ join.listenablesEmitted = new Array(join.numberOfListenables); | ||
},{"./createStore":8}],11:[function(_dereq_,module,exports){ | ||
},{"./createStore":8,"./utils":13}],11:[function(_dereq_,module,exports){ | ||
var Reflux = _dereq_('../src'); | ||
@@ -756,0 +783,0 @@ |
@@ -1,1 +0,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.Reflux=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);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.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){"use strict";function c(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function d(){}d.prototype._events=void 0,d.prototype.listeners=function(a){if(!this._events||!this._events[a])return[];for(var b=0,c=this._events[a].length,d=[];c>b;b++)d.push(this._events[a][b].fn);return d},d.prototype.emit=function(a,b,c,d,e,f){if(!this._events||!this._events[a])return!1;var g,h,i,j=this._events[a],k=j.length,l=arguments.length,m=j[0];if(1===k){switch(m.once&&this.removeListener(a,m.fn,!0),l){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,b),!0;case 3:return m.fn.call(m.context,b,c),!0;case 4:return m.fn.call(m.context,b,c,d),!0;case 5:return m.fn.call(m.context,b,c,d,e),!0;case 6:return m.fn.call(m.context,b,c,d,e,f),!0}for(h=1,g=new Array(l-1);l>h;h++)g[h-1]=arguments[h];m.fn.apply(m.context,g)}else for(h=0;k>h;h++)switch(j[h].once&&this.removeListener(a,j[h].fn,!0),l){case 1:j[h].fn.call(j[h].context);break;case 2:j[h].fn.call(j[h].context,b);break;case 3:j[h].fn.call(j[h].context,b,c);break;default:if(!g)for(i=1,g=new Array(l-1);l>i;i++)g[i-1]=arguments[i];j[h].fn.apply(j[h].context,g)}return!0},d.prototype.on=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this)),this},d.prototype.once=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this,!0)),this},d.prototype.removeListener=function(a,b,c){if(!this._events||!this._events[a])return this;var d=this._events[a],e=[];if(b)for(var f=0,g=d.length;g>f;f++)d[f].fn!==b&&d[f].once!==c&&e.push(d[f]);return this._events[a]=e.length?e:null,this},d.prototype.removeAllListeners=function(a){return this._events?(a?this._events[a]=null:this._events={},this):this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prototype.setMaxListeners=function(){return this},d.EventEmitter=d,d.EventEmitter2=d,d.EventEmitter3=d,"object"==typeof b&&b.exports&&(b.exports=d)},{}],2:[function(a,b,c){c.createdStores=[],c.createdActions=[],c.reset=function(){for(;c.createdStores.length;)c.createdStores.pop();for(;c.createdActions.length;)c.createdActions.pop()}},{}],3:[function(a,b){var c=a("./utils"),d=a("./joins").instanceJoinCreator;b.exports={hasListener:function(a){for(var b,c=0;c<(this.subscriptions||[]).length;++c)if(b=this.subscriptions[c].listenable,b===a||b.hasListener&&b.hasListener(a))return!0;return!1},listenToMany:function(a){for(var b in a){var d=c.callbackName(b),e=this[d]?d:this[b]?b:void 0;e&&this.listenTo(a[b],e,this[d+"Default"]||this[e+"Default"]||e)}},validateListening:function(a){return a===this?"Listener is not able to listen to itself":c.isFunction(a.listen)?a.hasListener&&a.hasListener(this)?"Listener cannot listen to this listenable because of circular loop":void 0:a+" is missing a listen method"},listenTo:function(a,b,d){var e,f,g,h=this.subscriptions=this.subscriptions||[];return c.throwIf(this.validateListening(a)),this.fetchDefaultData(a,d),e=a.listen(this[b]||b,this),f=function(){var a=h.indexOf(g);c.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),e()},g={stop:f,listenable:a},h.push(g),g},stopListeningTo:function(a){for(var b,d=0,e=this.subscriptions||[];d<e.length;d++)if(b=e[d],b.listenable===a)return b.stop(),c.throwIf(-1!==e.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},stopListeningToAll:function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),c.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},fetchDefaultData:function(a,b){b=b&&this[b]||b;var d=this;c.isFunction(b)&&c.isFunction(a.getDefaultData)&&(data=a.getDefaultData(),data&&c.isFunction(data.then)?data.then(function(){b.apply(d,arguments)}):b.call(this,data))},joinTrailing:d("last"),joinLeading:d("first"),joinConcat:d("all"),joinStrict:d("strict")}},{"./joins":10,"./utils":13}],4:[function(a,b){var c=a("./utils"),d=a("./ListenerMethods");b.exports=c.extend({componentWillUnmount:d.stopListeningToAll},d)},{"./ListenerMethods":3,"./utils":13}],5:[function(a,b){var c=a("./utils");b.exports={preEmit:function(){},shouldEmit:function(){return!0},listen:function(a,b){var c=function(c){a.apply(b,c)},d=this;return this.emitter.addListener(this.eventLabel,c),function(){d.emitter.removeListener(d.eventLabel,c)}},trigger:function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:c.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},triggerAsync:function(){var a=arguments,b=this;c.nextTick(function(){b.trigger.apply(b,a)})}}},{"./utils":13}],6:[function(a,b){var c=a("../src"),d=a("./utils");b.exports=function(a,b){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}var f=this,g=void 0===b?this.setState:function(a){f.setState(d.object([b],[a]))};this.listenTo(a,g,g)},componentWillUnmount:c.ListenerMixin.componentWillUnmount}}},{"../src":9,"./utils":13}],7:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){a=a||{};for(var b in a)if(!f[b]&&d.PublisherMethods[b])throw new Error("Cannot override API method "+b+" in action creation. Use another method name or override it on Reflux.PublisherMethods instead.");var g=c.extend({eventLabel:"action",emitter:new c.EventEmitter,_isAction:!0},d.PublisherMethods,a),h=function(){h[h.sync?"trigger":"triggerAsync"].apply(h,arguments)};return c.extend(h,g),e.createdActions.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],8:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){function b(){var a,b=0;if(this.subscriptions=[],this.emitter=new c.EventEmitter,this.eventLabel="change",this.init&&c.isFunction(this.init)&&this.init(),this.listenables)for(a=[].concat(this.listenables);b<a.length;b++)this.listenToMany(a[b])}a=a||{};for(var g in a)if(!f[g]&&(d.PublisherMethods[g]||d.ListenerMethods[g]))throw new Error("Cannot override API method "+g+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");c.extend(b.prototype,d.ListenerMethods,d.PublisherMethods,a);var h=new b;return e.createdStores.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],9:[function(a,b,c){c.ListenerMethods=a("./ListenerMethods"),c.PublisherMethods=a("./PublisherMethods"),c.createAction=a("./createAction"),c.createStore=a("./createStore"),c.connect=a("./connect"),c.ListenerMixin=a("./ListenerMixin"),c.listenTo=a("./listenTo"),c.listenToMany=a("./listenToMany");var d=a("./joins").staticJoinCreator;c.joinTrailing=c.all=d("last"),c.joinLeading=d("first"),c.joinStrict=d("strict"),c.joinConcat=d("all"),c.createActions=function(a){for(var b=0,d={};b<a.length;b++)d[a[b]]=c.createAction();return d},c.setEventEmitter=function(b){var c=a("./utils");c.EventEmitter=b},c.nextTick=function(b){var c=a("./utils");c.nextTick=b},c.__keep=a("./Keep")},{"./Keep":2,"./ListenerMethods":3,"./ListenerMixin":4,"./PublisherMethods":5,"./connect":6,"./createAction":7,"./createStore":8,"./joins":10,"./listenTo":11,"./listenToMany":12,"./utils":13}],10:[function(a,b,c){function d(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function e(a,b){return function(){var c=g.call(arguments);if(b.listenablesEmitted[a])switch(b.strategy){case"strict":throw new Error("Strict join failed because listener triggered twice.");case"last":b.args[a]=c;break;case"all":b.args[a].push(c)}else b.listenablesEmitted[a]=!0,b.args[a]="all"===b.strategy?[c]:c;f(b)}}function f(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),d(a)}var g=Array.prototype.slice,h=a("./createStore"),i={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"};c.staticJoinCreator=function(a){return function(){var b=g.call(arguments);return h({init:function(){this[i[a]].apply(this,b.concat("triggerAsync"))}})}},c.instanceJoinCreator=function(a){return function(){for(var b=g.call(arguments),c=b.pop(),f=b.length,h={numberOfListenables:f,callback:this[c]||c,listener:this,strategy:a},i=0;f>i;i++)this.listenTo(b[i],e(i,h));d(h)}}},{"./createStore":8}],11:[function(a,b){var c=a("../src");b.exports=function(a,b,d){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}this.listenTo(a,b,d)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],12:[function(a,b){var c=a("../src");b.exports=function(a){return{componentDidMount:function(){for(var b in c.ListenerMethods)if(this[b]!==c.ListenerMethods[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=c.ListenerMethods[b]}this.listenToMany(a)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],13:[function(a,b,c){var d=c.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a};c.extend=function(a){if(!d(a))return a;for(var b,c,e=1,f=arguments.length;f>e;e++){b=arguments[e];for(c in b)a[c]=b[c]}return a},c.isFunction=function(a){return"function"==typeof a},c.EventEmitter=a("eventemitter3"),c.nextTick=function(a){setTimeout(a,0)},c.callbackName=function(a){return"on"+a.charAt(0).toUpperCase()+a.slice(1)},c.object=function(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c},c.isArguments=function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&("[object Arguments]"===toString.call(a)||hasOwnProperty.call(a,"callee"&&!propertyIsEnumerable.call(a,"callee")))||!1},c.throwIf=function(a,b){if(a)throw Error(b||a)}},{eventemitter3:1}]},{},[9])(9)}); | ||
!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.Reflux=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);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.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){"use strict";function c(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function d(){}d.prototype._events=void 0,d.prototype.listeners=function(a){if(!this._events||!this._events[a])return[];for(var b=0,c=this._events[a].length,d=[];c>b;b++)d.push(this._events[a][b].fn);return d},d.prototype.emit=function(a,b,c,d,e,f){if(!this._events||!this._events[a])return!1;var g,h,i,j=this._events[a],k=j.length,l=arguments.length,m=j[0];if(1===k){switch(m.once&&this.removeListener(a,m.fn,!0),l){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,b),!0;case 3:return m.fn.call(m.context,b,c),!0;case 4:return m.fn.call(m.context,b,c,d),!0;case 5:return m.fn.call(m.context,b,c,d,e),!0;case 6:return m.fn.call(m.context,b,c,d,e,f),!0}for(h=1,g=new Array(l-1);l>h;h++)g[h-1]=arguments[h];m.fn.apply(m.context,g)}else for(h=0;k>h;h++)switch(j[h].once&&this.removeListener(a,j[h].fn,!0),l){case 1:j[h].fn.call(j[h].context);break;case 2:j[h].fn.call(j[h].context,b);break;case 3:j[h].fn.call(j[h].context,b,c);break;default:if(!g)for(i=1,g=new Array(l-1);l>i;i++)g[i-1]=arguments[i];j[h].fn.apply(j[h].context,g)}return!0},d.prototype.on=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this)),this},d.prototype.once=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this,!0)),this},d.prototype.removeListener=function(a,b,c){if(!this._events||!this._events[a])return this;var d=this._events[a],e=[];if(b)for(var f=0,g=d.length;g>f;f++)d[f].fn!==b&&d[f].once!==c&&e.push(d[f]);return this._events[a]=e.length?e:null,this},d.prototype.removeAllListeners=function(a){return this._events?(a?this._events[a]=null:this._events={},this):this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prototype.setMaxListeners=function(){return this},d.EventEmitter=d,d.EventEmitter2=d,d.EventEmitter3=d,"object"==typeof b&&b.exports&&(b.exports=d)},{}],2:[function(a,b,c){c.createdStores=[],c.createdActions=[],c.reset=function(){for(;c.createdStores.length;)c.createdStores.pop();for(;c.createdActions.length;)c.createdActions.pop()}},{}],3:[function(a,b){var c=a("./utils"),d=a("./joins").instanceJoinCreator;b.exports={hasListener:function(a){for(var b,c,d,e=0;e<(this.subscriptions||[]).length;++e)for(d=[].concat(this.subscriptions[e].listenable),b=0;b<d.length;b++)if(c=d[b],c===a||c.hasListener&&c.hasListener(a))return!0;return!1},listenToMany:function(a){for(var b in a){var d=c.callbackName(b),e=this[d]?d:this[b]?b:void 0;e&&this.listenTo(a[b],e,this[d+"Default"]||this[e+"Default"]||e)}},validateListening:function(a){return a===this?"Listener is not able to listen to itself":c.isFunction(a.listen)?a.hasListener&&a.hasListener(this)?"Listener cannot listen to this listenable because of circular loop":void 0:a+" is missing a listen method"},listenTo:function(a,b,d){var e,f,g,h=this.subscriptions=this.subscriptions||[];return c.throwIf(this.validateListening(a)),this.fetchDefaultData(a,d),e=a.listen(this[b]||b,this),f=function(){var a=h.indexOf(g);c.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),e()},g={stop:f,listenable:a},h.push(g),g},stopListeningTo:function(a){for(var b,d=0,e=this.subscriptions||[];d<e.length;d++)if(b=e[d],b.listenable===a)return b.stop(),c.throwIf(-1!==e.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},stopListeningToAll:function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),c.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},fetchDefaultData:function(a,b){b=b&&this[b]||b;var d=this;c.isFunction(b)&&c.isFunction(a.getDefaultData)&&(data=a.getDefaultData(),data&&c.isFunction(data.then)?data.then(function(){b.apply(d,arguments)}):b.call(this,data))},joinTrailing:d("last"),joinLeading:d("first"),joinConcat:d("all"),joinStrict:d("strict")}},{"./joins":10,"./utils":13}],4:[function(a,b){var c=a("./utils"),d=a("./ListenerMethods");b.exports=c.extend({componentWillUnmount:d.stopListeningToAll},d)},{"./ListenerMethods":3,"./utils":13}],5:[function(a,b){var c=a("./utils");b.exports={preEmit:function(){},shouldEmit:function(){return!0},listen:function(a,b){var c=function(c){a.apply(b,c)},d=this;return this.emitter.addListener(this.eventLabel,c),function(){d.emitter.removeListener(d.eventLabel,c)}},trigger:function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:c.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},triggerAsync:function(){var a=arguments,b=this;c.nextTick(function(){b.trigger.apply(b,a)})}}},{"./utils":13}],6:[function(a,b){var c=a("../src"),d=a("./utils");b.exports=function(a,b){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}var f=this,g=void 0===b?this.setState:function(a){f.setState(d.object([b],[a]))};this.listenTo(a,g,g)},componentWillUnmount:c.ListenerMixin.componentWillUnmount}}},{"../src":9,"./utils":13}],7:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){a=a||{};for(var b in a)if(!f[b]&&d.PublisherMethods[b])throw new Error("Cannot override API method "+b+" in action creation. Use another method name or override it on Reflux.PublisherMethods instead.");var g=c.extend({eventLabel:"action",emitter:new c.EventEmitter,_isAction:!0},d.PublisherMethods,a),h=function(){h[h.sync?"trigger":"triggerAsync"].apply(h,arguments)};return c.extend(h,g),e.createdActions.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],8:[function(a,b){var c=a("./utils"),d=a("../src"),e=a("./Keep"),f={preEmit:1,shouldEmit:1};b.exports=function(a){function b(){var a,b=0;if(this.subscriptions=[],this.emitter=new c.EventEmitter,this.eventLabel="change",this.init&&c.isFunction(this.init)&&this.init(),this.listenables)for(a=[].concat(this.listenables);b<a.length;b++)this.listenToMany(a[b])}a=a||{};for(var g in a)if(!f[g]&&(d.PublisherMethods[g]||d.ListenerMethods[g]))throw new Error("Cannot override API method "+g+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");c.extend(b.prototype,d.ListenerMethods,d.PublisherMethods,a);var h=new b;return e.createdStores.push(h),h}},{"../src":9,"./Keep":2,"./utils":13}],9:[function(a,b,c){c.ListenerMethods=a("./ListenerMethods"),c.PublisherMethods=a("./PublisherMethods"),c.createAction=a("./createAction"),c.createStore=a("./createStore"),c.connect=a("./connect"),c.ListenerMixin=a("./ListenerMixin"),c.listenTo=a("./listenTo"),c.listenToMany=a("./listenToMany");var d=a("./joins").staticJoinCreator;c.joinTrailing=c.all=d("last"),c.joinLeading=d("first"),c.joinStrict=d("strict"),c.joinConcat=d("all"),c.createActions=function(a){for(var b=0,d={};b<a.length;b++)d[a[b]]=c.createAction();return d},c.setEventEmitter=function(b){var c=a("./utils");c.EventEmitter=b},c.nextTick=function(b){var c=a("./utils");c.nextTick=b},c.__keep=a("./Keep")},{"./Keep":2,"./ListenerMethods":3,"./ListenerMixin":4,"./PublisherMethods":5,"./connect":6,"./createAction":7,"./createStore":8,"./joins":10,"./listenTo":11,"./listenToMany":12,"./utils":13}],10:[function(a,b,c){function d(a,b,c){return function(){var d,e=c.subscriptions;for(index=e?e.indexOf(a):-1,i.throwIf(-1===index,"Tried to remove join already gone from subscriptions list!"),d=0;d<b.length;d++)b[d]();e.splice(index,1)}}function e(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function f(a,b){return function(){var c=h.call(arguments);if(b.listenablesEmitted[a])switch(b.strategy){case"strict":throw new Error("Strict join failed because listener triggered twice.");case"last":b.args[a]=c;break;case"all":b.args[a].push(c)}else b.listenablesEmitted[a]=!0,b.args[a]="all"===b.strategy?[c]:c;g(b)}}function g(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),e(a)}var h=Array.prototype.slice,i=a("./utils"),j=a("./createStore"),k={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"};c.staticJoinCreator=function(a){return function(){var b=h.call(arguments);return j({init:function(){this[k[a]].apply(this,b.concat("triggerAsync"))}})}},c.instanceJoinCreator=function(a){return function(){i.throwIf(arguments.length<3,"Cannot create a join with less than 2 listenables!");var b,c,g=h.call(arguments),j=g.pop(),k=g.length,l={numberOfListenables:k,callback:this[j]||j,listener:this,strategy:a},m=[];for(b=0;k>b;b++)i.throwIf(this.validateListening(g[b]));for(b=0;k>b;b++)m.push(g[b].listen(f(b,l),this));return e(l),c={listenable:g},c.stop=d(c,m,this),this.subscriptions=(this.subscriptions||[]).concat(c),c}}},{"./createStore":8,"./utils":13}],11:[function(a,b){var c=a("../src");b.exports=function(a,b,d){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}this.listenTo(a,b,d)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],12:[function(a,b){var c=a("../src");b.exports=function(a){return{componentDidMount:function(){for(var b in c.ListenerMethods)if(this[b]!==c.ListenerMethods[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=c.ListenerMethods[b]}this.listenToMany(a)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"../src":9}],13:[function(a,b,c){var d=c.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a};c.extend=function(a){if(!d(a))return a;for(var b,c,e=1,f=arguments.length;f>e;e++){b=arguments[e];for(c in b)a[c]=b[c]}return a},c.isFunction=function(a){return"function"==typeof a},c.EventEmitter=a("eventemitter3"),c.nextTick=function(a){setTimeout(a,0)},c.callbackName=function(a){return"on"+a.charAt(0).toUpperCase()+a.slice(1)},c.object=function(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c},c.isArguments=function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&("[object Arguments]"===toString.call(a)||hasOwnProperty.call(a,"callee"&&!propertyIsEnumerable.call(a,"callee")))||!1},c.throwIf=function(a,b){if(a)throw Error(b||a)}},{eventemitter3:1}]},{},[9])(9)}); |
{ | ||
"name": "reflux", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
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
169774
3342