Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mixin.Observable: renamed addSubscription to publishSubscription to m…

…ake its purpose more clear
  • Loading branch information...
commit 3c80bc3f452751d965047c25fbdf865b7e6daf72 1 parent 0804716
Kevin Malakoff authored
2  README.md
View
@@ -117,7 +117,7 @@ Provides ways to manage flags and to get a callback when they change.
Provides ways some basic reference counting and to get a callback when your instance is released.
## Subscriptions
-Provides a way to publish subscriptions (addSubscription) and notify subscribers when they change. You can mixin: Observable, Subscriber or ObservableSubscriber.
+Provides a way to publish subscriptions (publishSubscription) and notify subscribers when they change. You can mixin: Observable, Subscriber or ObservableSubscriber.
-> this give a more advanced example of what is possible.
## Timeouts
8 build/mixin_subscriptions.js
View
@@ -152,7 +152,7 @@ Mixin.Subscriptions.Observable._mixin_info = {
_results = [];
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
arg = arguments[_i];
- _results.push(this.addSubscription.apply(this, _.isArray(arg) ? arg : [arg]));
+ _results.push(this.publishSubscription.apply(this, _.isArray(arg) ? arg : [arg]));
}
return _results;
},
@@ -178,15 +178,15 @@ Mixin.Subscriptions.Observable._mixin_info = {
instance_data = Mixin.instanceData(this, 'Observable');
return instance_data.subscriptions.hasOwnProperty(subscription_name);
},
- addSubscription: function(subscription_name, subscription_type) {
+ publishSubscription: function(subscription_name, subscription_type) {
var instance_data;
instance_data = Mixin.instanceData(this, 'Observable');
if (subscription_type === void 0) {
subscription_type = Mixin.Subscription.TYPE.MULTIPLE;
}
if (Mixin.DEBUG) {
- Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name');
- Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name');
+ Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name');
+ Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name');
}
instance_data.subscriptions[subscription_name] = new Mixin.Subscriptions._Subscription(this, subscription_type);
return this;
2  build/mixin_subscriptions.min.js
View
@@ -6,4 +6,4 @@
https://github.com/kmalakoff/mixin/blob/master/LICENSE
Dependencies: Mixin.Core, Underscore.js, Underscore-Awesomer.js
*/
-if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Subscriptions: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.Subscriptions||(Mixin.Subscriptions={});Mixin.Subscriptions._SubscriptionLink=(function(){function a(f,d,e,b){var c;this.subscription=f;this.subscriber=d;this.notification_callback=e;this.options=_.clone(b||{});c=Mixin.instanceData(this.subscriber,"Subscriber");c.subscription_backlinks.push(this)}a.prototype.mustKeepUntilDestroyed=function(){return(this.options.keep_until_destroyed===void 0)||!this.options.keep_until_destroyed};a.prototype.destroy=function(){var b;if(!this.subscription){throw new Error("Mixin.Subscriptions: _SubscriptionLink destroyed multiple times")}if(this.options.destroy){this.options.destroy();this.options.destroy=null}b=Mixin.instanceData(this.subscriber,"Subscriber");_.remove(b.subscription_backlinks,this);_.remove(this.subscription.subscription_links,this);this.subscription=null;this.subscriber=null;this.notification_callback=null;return this.options=null};return a})();Mixin.Subscription||(Mixin.Subscription={});Mixin.Subscription.TYPE={};Mixin.Subscription.TYPE.MULTIPLE=0;Mixin.Subscription.TYPE.EXCLUSIVE=1;Mixin.Subscriptions._Subscription=(function(){function a(c,b){this.observable=c;this.subscription_type=b;if(Mixin.DEBUG){if((typeof this.subscription_type!=="number")||(this.subscription_type<Mixin.Subscription.TYPE.MULTIPLE)||(this.subscription_type>Mixin.Subscription.TYPE.EXCLUSIVE)){throw new Error("Mixin.Subscriptions: Mixin.Subscription.TYPE is invalid")}}this.subscription_links=[]}a.prototype.addSubscriber=function(c,d,b){if(this.subscription_type===Mixin.Subscription.TYPE.EXCLUSIVE){this.removeSubscribers(function(e){return e.mustKeepUntilDestroyed()})}return this.subscription_links.push(new Mixin.Subscriptions._SubscriptionLink(this,c,d,b))};a.prototype.removeSubscriber=function(c,d,b){var e;e=_.find(this.subscription_links,function(f){return(c===f.subscriber)&&(d===f.notification_callback)});if(!e){throw new Error("Mixin.Subscriptions.removeSubscriber: subscription '"+b+"' does not exist for '"+(_.classOf(c))+"'")}_.remove(this.subscription_links,e);return e.destroy()};a.prototype.subscribers=function(g){var f,e,c,d,b;d=this.subscription_links;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(g.push(f.subscriber))}return b};a.prototype.notifySubscribers=function(){var d,g,f,c,e,b;d=Array.prototype.slice.call(arguments);e=this.subscription_links;b=[];for(f=0,c=e.length;f<c;f++){g=e[f];b.push(g.notification_callback.apply(g.subscriber,d))}return b};a.prototype.removeSubscribers=function(b){var d,j,h,f,i,c,g,e;if(b){d=_.select(this.subscription_links,b);if(d.length===0){return}this.subscription_links=_.difference(this.subscription_links,d);g=[];for(h=0,i=d.length;h<i;h++){j=d[h];g.push(j.destroy())}return g}else{d=this.subscription_links;this.subscription_links=[];e=[];for(f=0,c=d.length;f<c;f++){j=d[f];e.push(j.destroy())}return e}};a.prototype.destroy=function(){return _.remove(this.subscription_links,void 0,{callback:(function(b){return b.destroy()}),preclear:true})};return a})();Mixin.Subscriptions.Observable||(Mixin.Subscriptions.Observable={});Mixin.Subscriptions.Observable._mixin_info={mixin_name:"Observable",initialize:function(){var a,d,c,b;Mixin.instanceData(this,"Observable",{subscriptions:{},is_destroyed:false});b=[];for(d=0,c=arguments.length;d<c;d++){a=arguments[d];b.push(this.addSubscription.apply(this,_.isArray(a)?a:[a]))}return b},destroy:function(){var a;a=Mixin.instanceData(this,"Observable");if(a.is_destroyed){throw new Error("Mixin.Observable.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscriptions,void 0,{callback:(function(b){return b.destroy()})})},mixin_object:{hasSubscription:function(a){var b;if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.hasSubscription","subscription_name")}b=Mixin.instanceData(this,"Observable");return b.subscriptions.hasOwnProperty(a)},addSubscription:function(a,b){var c;c=Mixin.instanceData(this,"Observable");if(b===void 0){b=Mixin.Subscription.TYPE.MULTIPLE}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.addSubscription","subscription_name");Mixin.Core._Validate.noKey(c.subscriptions,a,"Mixin.Observable.addSubscription","subscription_name")}c.subscriptions[a]=new Mixin.Subscriptions._Subscription(this,b);return this},subscriptions:function(){var e,a,d,c,b;e=Mixin.instanceData(this,"Observable");d=[];b=e.subscriptions;for(a in b){c=b[a];d.push(a)}return d},subscribers:function(b){var g,a,e,c,d,f;e=[];g=Mixin.instanceData(this,"Observable");if(b===void 0){d=g.subscriptions;for(a in d){c=d[a];c.subscribers(e)}}else{if(!g.subscriptions.hasOwnProperty(b)){throw new Error("Mixin.Observable.subscribers: subscriber '"+(_classOf(this))+"' does not recognize '"+b+"'")}f=g.subscriptions;for(a in f){c=f[a];if(c.subscription_name===b){c.subscribers(e)}}}return _.uniq(e)},addSubscriber:function(h,d){var e,a,c,g,i,b,f;c=Mixin.instanceData(this,"Observable");i=function(k,m,j){var l;j||(j={});if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.addSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.addSubscriber","notification_callback");Mixin.Core._Validate.object(j,"Mixin.Observable.addSubscriber","options");if(j.destroy!==void 0){Mixin.Core._Validate.callback(j.destroy,"Mixin.Observable.addSubscriber","options.destroy")}}Mixin.Core._Validate.hasKey(c.subscriptions,k,"Mixin.Observable.addSubscriber","subscription_name");l=c.subscriptions[k];return l.addSubscriber(h,m,j)};e=Array.prototype.slice.call(arguments,1);Mixin.Core._Validate.instanceWithMixin(h,"Subscriber","Mixin.Observable.addSubscriber","subscriber");if(e.length>1){a=e[1];if(!((_.isString(a)&&this.hasSubscription(a))||(_.isArray(a)&&(a.length>=1)&&_.isString(a[0])&&this.hasSubscription(a[0])))){i.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(b=0,f=e.length;b<f;b++){g=e[b];if(_.isArray(g)){i.apply(this,g)}else{i.apply(g)}}return this},notifySubscribers:function(a){var c,b;c=Mixin.instanceData(this,"Observable");if(c.is_destroyed){return}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.notifySubscribers","subscription_name");Mixin.Core._Validate.hasKey(c.subscriptions,a,"Mixin.Observable.notifySubscribers")}b=c.subscriptions[a];if(!b){return}b.notifySubscribers.apply(b,Array.prototype.slice.call(arguments,1));return this},removeSubscriber:function(j,c,a){var g,d,f,i,b,e,h;f=Mixin.instanceData(this,"Observable");b=function(k,m){var l;if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.removeSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.removeSubscriber","notification_callback")}Mixin.Core._Validate.hasKey(f.subscriptions,k,"Mixin.Observable.removeSubscriber","subscription_name");l=f.subscriptions[k];return l.removeSubscriber(j,m,k)};g=Array.prototype.slice.call(arguments,1);if(Mixin.DEBUG){Mixin.Core._Validate.instanceWithMixin(j,"Subscriber","Mixin.Observable.removeSubscriber","subscriber")}if(g.length>1){d=g[1];if(!((_.isString(d)&&this.hasSubscription(d))||(_.isArray(d)&&(d.length>=1)&&_.isString(d[0])&&this.hasSubscription(d[0])))){b.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(e=0,h=g.length;e<h;e++){i=g[e];if(_.isArray(i)){b.apply(this,i)}else{b.apply(i)}}return this},removeSubscribers:function(b,e){var f,a,c,d;f=Mixin.instanceData(this,"Observable");if(Mixin.DEBUG){if(b!==void 0){Mixin.Core._Validate.string(b,"Mixin.Observable.removeSubscribers","subscription_name");Mixin.Core._Validate.hasKey(f.subscriptions,b,"Mixin.Observable.removeSubscribers")}if(e!==void 0){Mixin.Core._Validate.callback(e,"Mixin.Observable.removeSubscribers","test_fn")}}if(b){c=f.subscriptions[b];if(!c){return}c.removeSubscribers(e)}else{d=f.subscriptions;for(a in d){c=d[a];c.removeSubscribers(e)}}return this}}};Mixin.Subscriptions.Subscriber||(Mixin.Subscriptions.Subscriber={});Mixin.Subscriptions.Subscriber._mixin_info={mixin_name:"Subscriber",initialize:function(){return Mixin.instanceData(this,"Subscriber",{subscription_backlinks:[],is_destroyed:false})},destroy:function(){var a;a=Mixin.instanceData(this,"Subscriber");if(a.is_destroyed){throw new Error("Mixin.Subscriber.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscription_backlinks,void 0,{callback:(function(b){return b.destroy()}),preclear:true})},mixin_object:{observables:function(b){var h,d,j,f,e,i,a,g,c;h=Mixin.instanceData(this,"Subscriber");d=[];if(b===void 0){g=h.subscription_backlinks;for(f=0,i=g.length;f<i;f++){j=g[f];if(j.subscription&&(j.subscription.subscription_name===b)){d.push(j.subscription.observable)}}}else{if(Mixin.DEBUG){Mixin.Core._Validate.string(b,"Mixin.Subscriptions.observables","subscription_name")}c=h.subscription_backlinks;for(e=0,a=c.length;e<a;e++){j=c[e];if(j.subscription){d.push(j.subscription.observable)}}}return _.uniq(d)}}};Mixin.Subscriptions.ObservableSubscriber||(Mixin.Subscriptions.ObservableSubscriber={});Mixin.Subscriptions.ObservableSubscriber._mixin_info={mixin_name:"ObservableSubscriber",mixin_object:{},initialize:function(){return Mixin["in"](this,"Subscriber",["Observable"].concat(Array.prototype.slice.call(arguments)))},destroy:function(){return Mixin.out(this,"Subscriber","Observable")}};Mixin.registerMixin(Mixin.Subscriptions.Observable._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.Subscriber._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.ObservableSubscriber._mixin_info);
+if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Subscriptions: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.Subscriptions||(Mixin.Subscriptions={});Mixin.Subscriptions._SubscriptionLink=(function(){function a(f,d,e,b){var c;this.subscription=f;this.subscriber=d;this.notification_callback=e;this.options=_.clone(b||{});c=Mixin.instanceData(this.subscriber,"Subscriber");c.subscription_backlinks.push(this)}a.prototype.mustKeepUntilDestroyed=function(){return(this.options.keep_until_destroyed===void 0)||!this.options.keep_until_destroyed};a.prototype.destroy=function(){var b;if(!this.subscription){throw new Error("Mixin.Subscriptions: _SubscriptionLink destroyed multiple times")}if(this.options.destroy){this.options.destroy();this.options.destroy=null}b=Mixin.instanceData(this.subscriber,"Subscriber");_.remove(b.subscription_backlinks,this);_.remove(this.subscription.subscription_links,this);this.subscription=null;this.subscriber=null;this.notification_callback=null;return this.options=null};return a})();Mixin.Subscription||(Mixin.Subscription={});Mixin.Subscription.TYPE={};Mixin.Subscription.TYPE.MULTIPLE=0;Mixin.Subscription.TYPE.EXCLUSIVE=1;Mixin.Subscriptions._Subscription=(function(){function a(c,b){this.observable=c;this.subscription_type=b;if(Mixin.DEBUG){if((typeof this.subscription_type!=="number")||(this.subscription_type<Mixin.Subscription.TYPE.MULTIPLE)||(this.subscription_type>Mixin.Subscription.TYPE.EXCLUSIVE)){throw new Error("Mixin.Subscriptions: Mixin.Subscription.TYPE is invalid")}}this.subscription_links=[]}a.prototype.addSubscriber=function(c,d,b){if(this.subscription_type===Mixin.Subscription.TYPE.EXCLUSIVE){this.removeSubscribers(function(e){return e.mustKeepUntilDestroyed()})}return this.subscription_links.push(new Mixin.Subscriptions._SubscriptionLink(this,c,d,b))};a.prototype.removeSubscriber=function(c,d,b){var e;e=_.find(this.subscription_links,function(f){return(c===f.subscriber)&&(d===f.notification_callback)});if(!e){throw new Error("Mixin.Subscriptions.removeSubscriber: subscription '"+b+"' does not exist for '"+(_.classOf(c))+"'")}_.remove(this.subscription_links,e);return e.destroy()};a.prototype.subscribers=function(g){var f,e,c,d,b;d=this.subscription_links;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(g.push(f.subscriber))}return b};a.prototype.notifySubscribers=function(){var d,g,f,c,e,b;d=Array.prototype.slice.call(arguments);e=this.subscription_links;b=[];for(f=0,c=e.length;f<c;f++){g=e[f];b.push(g.notification_callback.apply(g.subscriber,d))}return b};a.prototype.removeSubscribers=function(b){var d,j,h,f,i,c,g,e;if(b){d=_.select(this.subscription_links,b);if(d.length===0){return}this.subscription_links=_.difference(this.subscription_links,d);g=[];for(h=0,i=d.length;h<i;h++){j=d[h];g.push(j.destroy())}return g}else{d=this.subscription_links;this.subscription_links=[];e=[];for(f=0,c=d.length;f<c;f++){j=d[f];e.push(j.destroy())}return e}};a.prototype.destroy=function(){return _.remove(this.subscription_links,void 0,{callback:(function(b){return b.destroy()}),preclear:true})};return a})();Mixin.Subscriptions.Observable||(Mixin.Subscriptions.Observable={});Mixin.Subscriptions.Observable._mixin_info={mixin_name:"Observable",initialize:function(){var a,d,c,b;Mixin.instanceData(this,"Observable",{subscriptions:{},is_destroyed:false});b=[];for(d=0,c=arguments.length;d<c;d++){a=arguments[d];b.push(this.publishSubscription.apply(this,_.isArray(a)?a:[a]))}return b},destroy:function(){var a;a=Mixin.instanceData(this,"Observable");if(a.is_destroyed){throw new Error("Mixin.Observable.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscriptions,void 0,{callback:(function(b){return b.destroy()})})},mixin_object:{hasSubscription:function(a){var b;if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.hasSubscription","subscription_name")}b=Mixin.instanceData(this,"Observable");return b.subscriptions.hasOwnProperty(a)},publishSubscription:function(a,b){var c;c=Mixin.instanceData(this,"Observable");if(b===void 0){b=Mixin.Subscription.TYPE.MULTIPLE}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.publishSubscription","subscription_name");Mixin.Core._Validate.noKey(c.subscriptions,a,"Mixin.Observable.publishSubscription","subscription_name")}c.subscriptions[a]=new Mixin.Subscriptions._Subscription(this,b);return this},subscriptions:function(){var e,a,d,c,b;e=Mixin.instanceData(this,"Observable");d=[];b=e.subscriptions;for(a in b){c=b[a];d.push(a)}return d},subscribers:function(b){var g,a,e,c,d,f;e=[];g=Mixin.instanceData(this,"Observable");if(b===void 0){d=g.subscriptions;for(a in d){c=d[a];c.subscribers(e)}}else{if(!g.subscriptions.hasOwnProperty(b)){throw new Error("Mixin.Observable.subscribers: subscriber '"+(_classOf(this))+"' does not recognize '"+b+"'")}f=g.subscriptions;for(a in f){c=f[a];if(c.subscription_name===b){c.subscribers(e)}}}return _.uniq(e)},addSubscriber:function(h,d){var e,a,c,g,i,b,f;c=Mixin.instanceData(this,"Observable");i=function(k,m,j){var l;j||(j={});if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.addSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.addSubscriber","notification_callback");Mixin.Core._Validate.object(j,"Mixin.Observable.addSubscriber","options");if(j.destroy!==void 0){Mixin.Core._Validate.callback(j.destroy,"Mixin.Observable.addSubscriber","options.destroy")}}Mixin.Core._Validate.hasKey(c.subscriptions,k,"Mixin.Observable.addSubscriber","subscription_name");l=c.subscriptions[k];return l.addSubscriber(h,m,j)};e=Array.prototype.slice.call(arguments,1);Mixin.Core._Validate.instanceWithMixin(h,"Subscriber","Mixin.Observable.addSubscriber","subscriber");if(e.length>1){a=e[1];if(!((_.isString(a)&&this.hasSubscription(a))||(_.isArray(a)&&(a.length>=1)&&_.isString(a[0])&&this.hasSubscription(a[0])))){i.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(b=0,f=e.length;b<f;b++){g=e[b];if(_.isArray(g)){i.apply(this,g)}else{i.apply(g)}}return this},notifySubscribers:function(a){var c,b;c=Mixin.instanceData(this,"Observable");if(c.is_destroyed){return}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.notifySubscribers","subscription_name");Mixin.Core._Validate.hasKey(c.subscriptions,a,"Mixin.Observable.notifySubscribers")}b=c.subscriptions[a];if(!b){return}b.notifySubscribers.apply(b,Array.prototype.slice.call(arguments,1));return this},removeSubscriber:function(j,c,a){var g,d,f,i,b,e,h;f=Mixin.instanceData(this,"Observable");b=function(k,m){var l;if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.removeSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.removeSubscriber","notification_callback")}Mixin.Core._Validate.hasKey(f.subscriptions,k,"Mixin.Observable.removeSubscriber","subscription_name");l=f.subscriptions[k];return l.removeSubscriber(j,m,k)};g=Array.prototype.slice.call(arguments,1);if(Mixin.DEBUG){Mixin.Core._Validate.instanceWithMixin(j,"Subscriber","Mixin.Observable.removeSubscriber","subscriber")}if(g.length>1){d=g[1];if(!((_.isString(d)&&this.hasSubscription(d))||(_.isArray(d)&&(d.length>=1)&&_.isString(d[0])&&this.hasSubscription(d[0])))){b.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(e=0,h=g.length;e<h;e++){i=g[e];if(_.isArray(i)){b.apply(this,i)}else{b.apply(i)}}return this},removeSubscribers:function(b,e){var f,a,c,d;f=Mixin.instanceData(this,"Observable");if(Mixin.DEBUG){if(b!==void 0){Mixin.Core._Validate.string(b,"Mixin.Observable.removeSubscribers","subscription_name");Mixin.Core._Validate.hasKey(f.subscriptions,b,"Mixin.Observable.removeSubscribers")}if(e!==void 0){Mixin.Core._Validate.callback(e,"Mixin.Observable.removeSubscribers","test_fn")}}if(b){c=f.subscriptions[b];if(!c){return}c.removeSubscribers(e)}else{d=f.subscriptions;for(a in d){c=d[a];c.removeSubscribers(e)}}return this}}};Mixin.Subscriptions.Subscriber||(Mixin.Subscriptions.Subscriber={});Mixin.Subscriptions.Subscriber._mixin_info={mixin_name:"Subscriber",initialize:function(){return Mixin.instanceData(this,"Subscriber",{subscription_backlinks:[],is_destroyed:false})},destroy:function(){var a;a=Mixin.instanceData(this,"Subscriber");if(a.is_destroyed){throw new Error("Mixin.Subscriber.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscription_backlinks,void 0,{callback:(function(b){return b.destroy()}),preclear:true})},mixin_object:{observables:function(b){var h,d,j,f,e,i,a,g,c;h=Mixin.instanceData(this,"Subscriber");d=[];if(b===void 0){g=h.subscription_backlinks;for(f=0,i=g.length;f<i;f++){j=g[f];if(j.subscription&&(j.subscription.subscription_name===b)){d.push(j.subscription.observable)}}}else{if(Mixin.DEBUG){Mixin.Core._Validate.string(b,"Mixin.Subscriptions.observables","subscription_name")}c=h.subscription_backlinks;for(e=0,a=c.length;e<a;e++){j=c[e];if(j.subscription){d.push(j.subscription.observable)}}}return _.uniq(d)}}};Mixin.Subscriptions.ObservableSubscriber||(Mixin.Subscriptions.ObservableSubscriber={});Mixin.Subscriptions.ObservableSubscriber._mixin_info={mixin_name:"ObservableSubscriber",mixin_object:{},initialize:function(){return Mixin["in"](this,"Subscriber",["Observable"].concat(Array.prototype.slice.call(arguments)))},destroy:function(){return Mixin.out(this,"Subscriber","Observable")}};Mixin.registerMixin(Mixin.Subscriptions.Observable._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.Subscriber._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.ObservableSubscriber._mixin_info);
2  docs/Mixins/mixin_subscriptions.txt
View
@@ -1,7 +1,7 @@
Mixin.Subscriptions Docs
********************
-This mixin provides a way to publish subscriptions (addSubscription) and notify subscribers when they change. You can mixin: Observable, Subscriber or ObservableSubscriber.
+This mixin provides a way to publish subscriptions (publishSubscription) and notify subscribers when they change. You can mixin: Observable, Subscriber or ObservableSubscriber.
TODO! for now, please study the tests in: test/mixin_subscriptions/mixin_subscriptions_tests.coffee
8 mixin.js
View
@@ -1578,7 +1578,7 @@ Mixin.Subscriptions.Observable._mixin_info = {
_results = [];
for (_i = 0, _len = arguments.length; _i < _len; _i++) {
arg = arguments[_i];
- _results.push(this.addSubscription.apply(this, _.isArray(arg) ? arg : [arg]));
+ _results.push(this.publishSubscription.apply(this, _.isArray(arg) ? arg : [arg]));
}
return _results;
},
@@ -1604,15 +1604,15 @@ Mixin.Subscriptions.Observable._mixin_info = {
instance_data = Mixin.instanceData(this, 'Observable');
return instance_data.subscriptions.hasOwnProperty(subscription_name);
},
- addSubscription: function(subscription_name, subscription_type) {
+ publishSubscription: function(subscription_name, subscription_type) {
var instance_data;
instance_data = Mixin.instanceData(this, 'Observable');
if (subscription_type === void 0) {
subscription_type = Mixin.Subscription.TYPE.MULTIPLE;
}
if (Mixin.DEBUG) {
- Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name');
- Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name');
+ Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name');
+ Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name');
}
instance_data.subscriptions[subscription_name] = new Mixin.Subscriptions._Subscription(this, subscription_type);
return this;
2  mixin.min.js
View
@@ -13,4 +13,4 @@
https://github.com/documentcloud/underscore
https://github.com/documentcloud/underscore/blob/master/LICENSE
*/
-var _;var __bind=function(a,b){return function(){return a.apply(b,arguments)}},__hasProp=Object.prototype.hasOwnProperty,__extends=function(d,b){for(var a in b){if(__hasProp.call(b,a)){d[a]=b[a]}}function c(){this.constructor=d}c.prototype=b.prototype;d.prototype=new c;d.__super__=b.prototype;return d};this.Mixin||(this.Mixin={});this.Mixin.Core||(this.Mixin.Core={});Mixin.VERSION="0.1.1";_||(_={});if(!_.isArray){_.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"}}if(!_.isString){_.isString=function(a){return !!(a===""||(a&&a.charCodeAt&&a.substr))}}if(!_.isFunction){_.isFunction=function(a){return !!(a&&a.constructor&&a.call&&a.apply)}}if(!_.isEmpty){_.isEmpty=function(c){var a,b;if(_.isArray(c)||_.isString(c)){return c.length===0}for(a in c){b=c[a];return false}return true}}if(!_.classOf){_.classOf=function(a){if(!(a instanceof Object)){return}if(a.prototype&&a.prototype.constructor&&a.prototype.constructor.name){return a.prototype.constructor.name}if(a.constructor&&a.constructor.name){return a.constructor.name}}}if(!_.size){_.size=function(c){var b,a;b=0;for(a in c){b++}return b}}if(!_.find){_.find=function(e,b){var c,d,a;for(d=0,a=e.length;d<a;d++){c=e[d];if(b(c)){return c}}return null}}Mixin.Core._Validate=(function(){function a(){}a.mixinInfo=function(b,d,c){if(!b){throw new Error(""+c+": mixin_info missing")}a.string(b.mixin_name,c,"mixin_name");if(!d&&Mixin.Core._Manager.available_mixins.hasOwnProperty(b.mixin_name)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' already registered")}if(!b.mixin_object){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' missing mixin_object")}if(!(b.mixin_object instanceof Object)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' mixin_object is invalid")}if(b.initialize&&!_.isFunction(b.initialize)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' initialize function is invalid")}if(b.destroy&&!_.isFunction(b.destroy)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' destroy function is invalid")}};a.instanceAndMixinName=function(c,d,b){if(!c){throw new Error(""+b+": mix_target missing")}a.string(d,b,"mixin_name");return a.instanceOrArray(c,b,"mix_target",d)};a.classConstructorAndMixinName=function(c,d,b){if(!c){throw new Error(""+b+": class constructor missing")}a.string(d,b,"mixin_name");if(!_.isFunction(c)){throw new Error(""+b+": class constructor invalid for '"+d+"'")}};a.exists=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}};a.object=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof d!=="object")||_.isArray(d)){throw new Error(""+b+": "+c+" invalid")}};a.uint=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!(typeof d!=="number")||(d<0)||(Math.floor(d)!==d)){throw new Error(""+b+": "+c+" invalid")}};a.string=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!_.isString(d)){throw new Error(""+b+": "+c+" invalid")}};a.stringArrayOrNestedStringArray=function(h,d,e){var f,g,c,b;if(h===void 0){throw new Error(""+d+": "+e+" missing")}if(!_.isArray(h)){throw new Error(""+d+": "+e+" invalid")}b=[];for(g=0,c=string_or_array.length;g<c;g++){f=string_or_array[g];b.push(((function(){if(_.isArray(f)&&(!f.length||!_.isString(f[0]))||!_.isString(f)){throw new Error(""+d+": "+e+" invalid")}})()))}return b};a.callback=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!_.isFunction(d)){throw new Error(""+b+": "+c+" invalid")}};a.instance=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof d!=="object"||_.isArray(d))||!_.isFunction(d.constructor)||(d.constructor.name==="Object")){throw new Error(""+b+": "+c+" invalid")}};a.instanceOrArray=function(e,b,c,d){if(e===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof e!=="object")||!_.isFunction(e.constructor)||(e.constructor.name==="Object")||_.isArray(e)){throw new Error(""+b+": "+c+" invalid")}};a.instanceWithMixin=function(e,d,b,c){a.instance(e,b,c);if(!Mixin.hasMixin(e,d)){throw new Error(""+b+": "+c+" missing mixin '"+d+"' on "+(_.classOf(e)))}};a.noKey=function(e,d,b,c){if(e.hasOwnProperty(d)){throw new Error(""+b+": "+d+" already exists for "+c)}};a.hasKey=function(e,d,b,c){if(!e.hasOwnProperty(d)){throw new Error(""+b+": "+d+" does not exist for "+c)}};return a})();Mixin.Core._InstanceRecord=(function(){function a(b){this.mix_target=b;this.initialized_mixins={}}a.prototype.destroy=function(){if(!_.isEmpty(this.initialized_mixins)){throw new Error("Mixin: non-empty instance record being destroyed")}if(this.backbone_destroy_fn){this.mix_target.unbind("destroy",this.backbone_destroy_fn);this.backbone_destroy_fn=null}return this.mix_target=null};a.prototype.hasMixin=function(d,c){var b;b=this.initialized_mixins.hasOwnProperty(d);if(b||!c){return b}this.initialized_mixins[d]={is_destroyed:false};if(Mixin.UNMIX_ON_BACKBONE_DESTROY&&(mixin_info.mixin_name==="Backbone.Events")&&!this.backbone_destroy_fn){this.backbone_destroy_fn=this._bindBackboneDestroyFn(this.mix_target);this.mix_target.bind("destroy",this.backbone_destroy_fn)}return true};a.prototype.collectMixins=function(d){var e,c,f,b;f=this.initialized_mixins;b=[];for(e in f){c=f[e];b.push(d.push(e))}return b};a.prototype.initializeMixin=function(b,c){this.initialized_mixins[b.mixin_name]={is_destroyed:false,destroy:b.destroy};if(b.initialize){b.initialize.apply(this.mix_target,c)}if(Mixin.UNMIX_ON_BACKBONE_DESTROY&&(b.mixin_name==="Backbone.Events")&&!this.backbone_destroy_fn){this.backbone_destroy_fn=this._bindBackboneDestroyFn(this.mix_target);return this.mix_target.bind("destroy",this.backbone_destroy_fn)}};a.prototype.destroyMixin=function(f){var c,b,e,d;if(f){if(!this.initialized_mixins.hasOwnProperty(f)){return false}return this._destroyMixinInfo(f)}else{b=false;d=this.initialized_mixins;for(c in d){e=d[c];b=true;this._destroyMixinInfo(c)}return b}};a.prototype._destroyMixinInfo=function(c){var b;b=this.initialized_mixins[c];if(b.is_destroyed){return true}b.is_destroyed=true;if(b.destroy){b.destroy.apply(this.mix_target);b.destroy=null}Mixin.Core._Manager._destroyInstanceData(this.mix_target,c);delete this.initialized_mixins[c];return true};a.prototype._bindBackboneDestroyFn=function(b){return __bind(function(){return Mixin.out(b)},this)};return a})();Mixin.Core._ClassRecord=(function(){function a(b){this.constructor=b;this.mixins={};this.instance_records=[]}a.prototype.mixIntoClass=function(d,b){var c,f,e;if(this.mixins.hasOwnProperty(b.mixin_name)){return}this.mixins[b.mixin_name]=b;if(!b.force){e=b.mixin_object;for(c in e){f=e[c];if(c in d){throw new Error("Mixin: property '"+c+"' clashes with existing property on '"+(_.classOf(d)))}}}return __extends(d.constructor.prototype,b.mixin_object)};a.prototype.classHasMixin=function(b){return this.mixins.hasOwnProperty(b)};a.prototype.instanceHasMixin=function(c,e,d){var b;b=this._getInstanceRecord(c);if(d){if(!this.mixins.hasOwnProperty(e)){this.mixins[e]=Mixin.Core._Manager._getMixinInfo(e)}if(!b){b=new Mixin.Core._InstanceRecord(c);this.instance_records.push(b)}return b.hasMixin(e,d)}else{if(b){return b.hasMixin(e)}else{return false}}};a.prototype.collectMixinsForInstance=function(b,d){var c;c=this._getInstanceRecord(d);if(!c){return}return c.collectMixins(b)};a.prototype.initializeInstance=function(e,b,d){var c;c=this._getInstanceRecord(e);if(c){c.initializeMixin(b,d);return}c=new Mixin.Core._InstanceRecord(e);this.instance_records.push(c);return c.initializeMixin(b,d)};a.prototype.destroyInstance=function(e,f){var d,c,b;if(f&&!this.mixins.hasOwnProperty(f)){return false}b=false;d=this.instance_records.length-1;while(d>=0){c=this.instance_records[d];if((c.mix_target===e)&&c.destroyMixin(f)){b=true;if(_.isEmpty(c.initialized_mixins)){c.destroy();this.instance_records.splice(d,1)}if(f){return true}}d--}return b};a.prototype._getInstanceRecord=function(d){var c,f,b,e;e=this.instance_records;for(f=0,b=e.length;f<b;f++){c=e[f];if(c.mix_target===d){return c}}};return a})();Mixin.Core._Manager=(function(){function a(){}a.available_mixins={};a.registerMixin=function(b,c){if(Mixin.DEBUG){Mixin.Core._Validate.mixinInfo(b,c,"Mixin.registerMixin")}a.available_mixins[b.mixin_name]=b;return true};a.isAvailable=function(b){return a.available_mixins.hasOwnProperty(b)};a._getMixinInfo=function(b){return a.available_mixins[b]};a.mixin=function(e){var d,h,g,c,f,b;c=__bind(function(k,l,m){var j,i;if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(k,l,"Mixin.mixin","mix_target");if(!this.isAvailable(l)){throw new Error("Mixin.mixin: '"+l+"' not found")}}i=a.available_mixins[l];if(!i){throw new Error("Mixin.mixin: '"+l+"' not found")}if(this.hasMixin(k,i.mixin_name)){return}j=a._findOrCreateClassRecord(k,i);j.mixIntoClass(k,i);return j.initializeInstance(k,i,Array.prototype.slice.call(arguments,2))},this);d=Array.prototype.slice.call(arguments,1);if(!d.length){throw new Error("Mixin: mixin_name missing")}if(d.length>1){h=d[1];if(!((_.isString(h)&&a.isAvailable(h))||(_.isArray(h)&&(h.length>=1)&&_.isString(h[0])&&a.isAvailable(h[0])))){c.apply(this,arguments);return e}}for(f=0,b=d.length;f<b;f++){g=d[f];if(_.isArray(g)){c.apply(this,[e].concat(g))}else{c(e,g)}}return e};a.mixout=function(i,e){var h,k,l,f,d,j,b,g,c;if(Mixin.DEBUG){Mixin.Core._Validate.instance(i,"Mixin.mixout","mix_target")}l=__bind(function(o,r){var n,q,m,p;if(Mixin.DEBUG){Mixin.Core._Validate.string(r,"Mixin.mixout","mixin_name")}if(o.constructor._mixin_class_records){p=o.constructor._mixin_class_records;for(q=0,m=p.length;q<m;q++){n=p[q];if(n.destroyInstance(o,r)){return o}}}return o},this);if(arguments.length>1){g=Array.prototype.slice.call(arguments,1);for(f=0,j=g.length;f<j;f++){k=g[f];l(i,k)}}else{if(i.constructor._mixin_class_records){c=i.constructor._mixin_class_records;for(d=0,b=c.length;d<b;d++){h=c[d];if(h.destroyInstance(i)){return i}}}}return i};a.hasMixin=function(d,f,e){var c,b;if(e){if(a.hasMixin(d,f)){return true}b=a.available_mixins[f];if(!b){return false}c=a._findOrCreateClassRecord(d,b);return c.instanceHasMixin(d,f,e)}else{if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(d,f,"Mixin.hasMixin","mix_target")}if(a.hasInstanceData(d,f)){return true}c=a._findClassRecord(d,f);if(!c){return false}return c.instanceHasMixin(d,f)}};a.mixins=function(e){var d,c,g,b,f;if(Mixin.DEBUG){Mixin.Core._Validate.instance(e,c,"Mixin.mixins","mix_target")}c=[];if(e.constructor._mixin_class_records){f=e.constructor._mixin_class_records;for(g=0,b=f.length;g<b;g++){d=f[g];d.collectMixinsForInstance(c,e)}}return c};a._getClassRecords=function(e){var d,h,c,g,b,f;h=[];c=e.constructor;while(c){if(c._mixin_class_records){f=c._mixin_class_records;for(g=0,b=f.length;g<b;g++){d=f[g];if(e instanceof d.constructor){h.push(d)}}}c=c.__super__&&(c.__super__.constructor!==c)?c.__super__.constructor:void 0}return h};a._findClassRecord=function(d,f){var c,g,e,b;g=this._getClassRecords(d);for(e=0,b=g.length;e<b;e++){c=g[e];if(c.classHasMixin(f)){return c}}};a._findOrCreateClassRecord=function(g,d){var f,e,c,b,h;f=a._findClassRecord(g,d.mixin_name);if(f){return f}if(g.constructor._mixin_class_records){f=_.find(g.constructor._mixin_class_records,function(i){return i.constructor===g.constructor})}if(!f){f=new Mixin.Core._ClassRecord(g.constructor);if(g.constructor._mixin_class_records){h=false;e=0;c=g.constructor._mixin_class_records.length;while(e<c){b=g.constructor._mixin_class_records[e];if(g instanceof b.constructor){g.constructor._mixin_class_records.splice(e,0,f);h=true;break}e++}if(!h){g.constructor._mixin_class_records.push(f)}}else{g.constructor._mixin_class_records=[f]}if(Mixin._statistics){Mixin._statistics.addClassRecord(f)}}return f};a.hasInstanceData=function(b,c){if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(b,c,"Mixin.hasInstanceData","mix_target")}return !!(b._mixin_data&&b._mixin_data.hasOwnProperty(c))};a.instanceData=function(b,d,c){if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(b,d,"Mixin.instanceData","mix_target");if(c===void 0){if(!("_mixin_data" in b)){throw new Error("Mixin.instanceData: no instance data on '"+(_.classOf(b))+"'")}if(!b._mixin_data.hasOwnProperty(d)){throw new Error("Mixin.instanceData: mixin '"+d+"' instance data not found on '"+(_.classOf(b))+"'")}}else{if(!a.hasMixin(b,d)){throw new Error("Mixin.instanceData: mixin '"+d+"' not mixed into '"+(_.classOf(b))+"'")}}}if(!(c===void 0)){if(!b._mixin_data){b._mixin_data={}}b._mixin_data[d]=c}return b._mixin_data[d]};a._destroyInstanceData=function(b,d){var c;if(!b._mixin_data){return}c=b._mixin_data[d];delete b._mixin_data[d];if(_.isEmpty(b._mixin_data)){return delete b._mixin_data}};return a})();Mixin.registerMixin=Mixin.Core._Manager.registerMixin;Mixin.isAvailable=Mixin.Core._Manager.isAvailable;Mixin.mixin=Mixin["in"]=Mixin.Core._Manager.mixin;Mixin.mixout=Mixin.out=Mixin.Core._Manager.mixout;Mixin.hasMixin=Mixin.exists=Mixin.Core._Manager.hasMixin;Mixin.mixins=Mixin.Core._Manager.mixins;Mixin.hasInstanceData=Mixin.hasID=Mixin.Core._Manager.hasInstanceData;Mixin.instanceData=Mixin.iD=Mixin.Core._Manager.instanceData;if(typeof exports!=="undefined"){exports.Mixin=Mixin}if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Core.Statistics: Dependency alert! Mixin is missing. Please ensure it is included")}if(this.Mixin.STATISTICS===void 0){this.Mixin.STATISTICS=true}Mixin.Core.Statistics=(function(){function a(){this.class_records=[]}a.prototype.addClassRecord=function(b){return this.class_records.push(b)};a.prototype.purge=function(){this.class_records=[];return this.clear()};a.prototype.clear=function(){this.by_instance_with_data=null;this.by_instance_get_mixins=null;this.by_mixin_get_instances=null;this.by_mixin_get_constructors=null;return this.by_constructor_get_instances=null};a.prototype.update=function(){this.clear();this.byInstance_getMixins();this.byInstance_withData();this.byMixin_getInstances();this.byMixin_getConstructors();return this.byConstructor_getInstances()};a.prototype.byInstance_getMixins=function(){var c,e,b,d;if(!this.by_instance_get_mixins){this.by_instance_get_mixins=[];d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetMixinsByInstance(c,this.by_instance_get_mixins)}}return this.by_instance_get_mixins};a.prototype.byInstance_withData=function(){var c,e,b,d;if(!this.by_instance_with_data){this.by_instance_with_data=[];d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetInstancesWithData(c,this.by_instance_with_data)}}return this.by_instance_with_data};a.prototype.byMixin_getInstances=function(){var c,e,b,d;if(!this.by_mixin_get_instances){this.by_mixin_get_instances={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetInstancesByMixin(c,this.by_mixin_get_instances)}}return this.by_mixin_get_instances};a.prototype.byMixin_getConstructors=function(){var c,e,b,d;if(!this.by_mixin_get_constructors){this.by_mixin_get_constructors={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetMixins(c,this.by_mixin_get_constructors)}}return this.by_mixin_get_constructors};a.prototype.byConstructor_getInstances=function(){var c,e,b,d;if(!this.by_constructor_get_instances){this.by_constructor_get_instances={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGroupInstances(c,this.by_constructor_get_instances)}}return this.by_constructor_get_instances};a.prototype.classRecordGetInstancesWithData=function(e,h){var d,g,c,f,b;f=e.instance_records;b=[];for(g=0,c=f.length;g<c;g++){d=f[g];b.push((d.mix_target&&d.mix_target._mixin_data?h.push(d.mix_target):void 0))}return b};a.prototype.classRecordGetInstancesByMixin=function(f,g){var j,i,b,d,h,e,c;if(!f.instance_records.length){return}e=f.instance_records;c=[];for(d=0,h=e.length;d<h;d++){j=e[d];c.push((function(){var l,k;l=j.initialized_mixins;k=[];for(i in l){b=l[i];k.push((!g.hasOwnProperty(i)?g[i]=[]:void 0,g[i].push(j.mix_target)))}return k})())}return c};a.prototype.classRecordGetMixinsByInstance=function(h,b){var l,k,c,i,f,j,g,d,e;g=h.instance_records;e=[];for(f=0,j=g.length;f<j;f++){l=g[f];i=[];d=l.initialized_mixins;for(k in d){c=d[k];i.push(k)}e.push(b.push({instance:l.mix_target,mixins:i}))}return e};a.prototype.classRecordGroupInstances=function(e,h){var d,g,c,f,b;if(!e.instance_records.length){return}if(!h.hasOwnProperty(e.constructor.name)){h[e.constructor]=[]}f=e.instance_records;b=[];for(g=0,c=f.length;g<c;g++){d=f[g];b.push(h[e.constructor].push(d.mix_target))}return b};a.prototype.classRecordGetMixins=function(g,d,e){var f,c,h,b;h=g.mixins;b=[];for(f in h){c=h[f];b.push((!d.hasOwnProperty(f)?d[f]=[]:void 0,d[f].push(g.constructor)))}return b};return a})();if(this.Mixin.STATISTICS){Mixin._statistics=new Mixin.Core.Statistics()}if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Backbone.Events: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Backbone.Events: Dependency alert! Underscore.js must be included before this file")}if(!this.Backbone||!this.Backbone.Events){throw new Error("Mixin.Backbone.Events: Dependency alert! Backbone.js must be included before this file")}Mixin.Backbone||(Mixin.Backbone={});Mixin.Backbone.Events||(Mixin.Backbone.Events={});Mixin.Backbone.Events._mixin_info={mixin_name:"Backbone.Events",mixin_object:Backbone.Events};Mixin.Backbone.Events.autoMarkNative=function(){var b,c,d,a;b=Backbone.Collection.prototype.initialize;Backbone.Collection.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return b.apply(this,arguments)};c=Backbone.Model.prototype.initialize;Backbone.Model.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return c.apply(this,arguments)};a=Backbone.View.prototype.initialize;Backbone.View.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return a.apply(this,arguments)};d=Backbone.Router.prototype.initialize;return Backbone.Router.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return d.apply(this,arguments)}};Mixin.registerMixin(Mixin.Backbone.Events._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.RefCount: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.RefCount||(Mixin.RefCount={});Mixin.RefCount._mixin_info={mixin_name:"RefCount",initialize:function(a){return Mixin.instanceData(this,"RefCount",{ref_count:1,release_callback:a})},mixin_object:{retain:function(){var a;a=Mixin.instanceData(this,"RefCount");if(a.ref_count<=0){throw new Error("Mixin.RefCount: ref_count is corrupt: "+a.ref_count)}a.ref_count++;return this},release:function(){var a;a=Mixin.instanceData(this,"RefCount");if(a.ref_count<=0){throw new Error("Mixin.RefCount: ref_count is corrupt: "+a.ref_count)}a.ref_count--;if((a.ref_count===0)&&a.release_callback){a.release_callback(this)}return this},refCount:function(){return Mixin.instanceData(this,"RefCount").ref_count}}};Mixin.registerMixin(Mixin.RefCount._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Flags: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.Flags||(Mixin.Flags={});Mixin.Flags._mixin_info={mixin_name:"Flags",initialize:function(a,b){if(a==null){a=0}return Mixin.instanceData(this,"Flags",{flags:a,change_callback:b})},mixin_object:{flags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");if(a!==void 0){b=c.flags;c.flags=a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}}return c.flags},hasFlags:function(a){var b;b=Mixin.instanceData(this,"Flags");return !!(b.flags&a)},setFlags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");b=c.flags;c.flags|=a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}return c.flags},resetFlags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");b=c.flags;c.flags&=~a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}return c.flags}}};Mixin.registerMixin(Mixin.Flags._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.AutoMemory: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.AutoMemory: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.AutoMemory: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.AutoMemory||(Mixin.AutoMemory={});Mixin.AutoMemory.root=this;Mixin.AutoMemory.WRAPPER=Mixin.AutoMemory.root["$"]?$:"$";Mixin.AutoMemory.Property=(function(){function a(b){this.owner=b}a.prototype.setArgs=function(){var f,e,c,d,b;if(!arguments.length){throw new Error("Mixin.AutoMemory: missing key")}this.args=Array.prototype.slice.call(arguments);if(!Mixin.DEBUG){return this}if(_.isArray(this.args[0])){d=this.args;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(this._validateEntry(f))}return b}else{return this._validateEntry(this.args)}};a.prototype.destroy=function(){var f,e,c,d,b;if(_.isArray(this.args[0])){d=this.args;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(this._destroyEntry(f))}return b}else{return this._destroyEntry(this.args)}};a.prototype._validateEntry=function(d){var c,b;b=d[0];c=d.length>1?d[1]:void 0;if(!_.keypathExists(this.owner,b)){throw new Error("Mixin.AutoMemory: property '"+b+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}if(c&&!(_.isFunction(c)||_.isString(c))){throw new Error("Mixin.AutoMemory: unexpected function reference for property '"+b+"' on '"+(_.classOf(this.owner))+"'")}};a.prototype._destroyEntry=function(g){var b,i,j,h,f,c,e,d;i=g[0];b=g.length>1?g[1]:void 0;if(!b){j=_.keypathValueOwner(this.owner,i);if(!j){throw new Error("Mixin.AutoMemory: property '"+i+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}j[i]=null;return}f=_.keypath(this.owner,i);if(!f){return}if(_.isFunction(b)){b.apply(this.owner,[f].concat(g.length>2?g.slice(2):[]))}else{if(_.isFunction(f[b])){f[b].apply(f,g.length>2?g.slice(2):[])}else{d=g.slice(1);for(c=0,e=d.length;c<e;c++){h=d[c];this._destroyEntry([h])}}}return _.keypath(this.owner,i,null)};return a})();Mixin.AutoMemory.WrappedProperty=(function(){function a(b,d,e,h){var g,c,f;this.owner=b;this.key=d;this.fn_ref=e;this.wrapper=h;if(this.fn_ref&&_.isArray(this.fn_ref)){if(Mixin.DEBUG&&!this.fn_ref.length){throw new Error("Mixin.AutoMemory: unexpected function reference")}this.args=this.fn_ref.splice(1);this.fn_ref=this.fn_ref[0]}if(!Mixin.DEBUG){return this}if(!this.key){throw new Error("Mixin.AutoMemory: missing key")}if(_.isArray(this.key)){f=this.key;for(g=0,c=f.length;g<c;g++){d=f[g];if(!_.keypathExists(this.owner,d)){throw new Error("Mixin.AutoMemory: property '"+d+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}}}else{if(!_.keypathExists(this.owner,this.key)){throw new Error("Mixin.AutoMemory: property '"+this.key+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}}if(this.fn_ref&&!(_.isFunction(this.fn_ref)||_.isString(this.fn_ref))){throw new Error("Mixin.AutoMemory: unexpected function reference")}if(!this.wrapper){throw new Error("Mixin.AutoMemory: missing wrapper")}}a.prototype.destroy=function(){var d,f,c,e,b;if(_.isArray(this.key)){e=this.key;b=[];for(f=0,c=e.length;f<c;f++){d=e[f];b.push(this._destroyKey(d))}return b}else{return this._destroyKey(this.key)}};a.prototype._destroyKey=function(b){var d,c,e;if(!this.fn_ref){_.keypath(this.owner,b,null);return}d=_.keypath(this.owner,b);if(!d){return}e=_.isString(this.wrapper)?Mixin.AutoMemory.root[this.wrapper]:this.wrapper;c=e(d);if(_.isFunction(this.fn_ref)){this.fn_ref.apply(this.owner,[c].concat(this.args?this.args.slice():[]))}else{if(Mixin.DEBUG&&!_.isFunction(c[this.fn_ref])){throw new Error("Mixin.AutoMemory: function '"+this.fn_ref+"' missing for wrapped property '"+b+"' on '"+(_.classOf(this.owner))+"'")}c[this.fn_ref].apply(c,this.args)}return _.keypath(this.owner,b,null)};return a})();Mixin.AutoMemory.Function=(function(){function a(c,d,b){this.object=c;this.fn_ref=d;this.args=b;if(!Mixin.DEBUG){return this}if(!this.fn_ref){throw new Error("Mixin.AutoMemory: missing fn_ref")}if(!_.isFunction(this.fn_ref)&&!(this.object&&_.isString(this.fn_ref)&&_.isFunction(this.object[this.fn_ref]))){throw new Error("Mixin.AutoMemory: unexpected function reference")}}a.prototype.destroy=function(){if(!this.object){this.fn_ref.apply(null,this.args);return}if(!_.isFunction(this.fn_ref)){this.object[this.fn_ref].apply(this.object,this.args);return}return this.fn_ref.apply(this.object,[this.object].concat(this.args?this.args.slice():[]))};return a})();Mixin.AutoMemory._mixin_info={mixin_name:"AutoMemory",initialize:function(){return Mixin.instanceData(this,"AutoMemory",[])},destroy:function(){var e,c,d,b,a;c=Mixin.instanceData(this,"AutoMemory");Mixin.instanceData(this,"AutoMemory",[]);a=[];for(d=0,b=c.length;d<b;d++){e=c[d];a.push(e.destroy())}return a},mixin_object:{autoProperty:function(b,c){var a;a=new Mixin.AutoMemory.Property(this);a.setArgs.apply(a,arguments);Mixin.instanceData(this,"AutoMemory").push(a);return this},autoWrappedProperty:function(a,b,c){if(c===void 0){c=Mixin.AutoMemory.WRAPPER}Mixin.instanceData(this,"AutoMemory").push(new Mixin.AutoMemory.WrappedProperty(this,a,b,c));return this},autoFunction:function(a,b){Mixin.instanceData(this,"AutoMemory").push(new Mixin.AutoMemory.Function(a,b,Array.prototype.slice.call(arguments,2)));return this}}};Mixin.registerMixin(Mixin.AutoMemory._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Underscore.js must be included before this file")}if(!this.Backbone){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Backbone.js must be included before this file")}Mixin.Backbone||(Mixin.Backbone={});Mixin.Backbone.LocalCollection||(Mixin.Backbone.LocalCollection={});Mixin.Backbone.LocalCollection._mixin_info={mixin_name:"Backbone.LocalCollection",force:true,initialize:function(){if(!(this instanceof Backbone.Collection)){throw new Error("Mixin.Backbone.LocalCollection: the mix_target '"+(_.classOf(this))+"' is not a Backbone.Collection")}},mixin_object:{_add:function(b,a){if(!b.id&&b.cid){b.id=b.cid}return this.constructor.__super__._add.apply(this,arguments)},url:function(){throw new Error("Mixin.Backbone.LocalCollection: url is not available for local collection '"+(_.classOf(this))+"'")},parse:function(a){throw new Error("Mixin.Backbone.LocalCollection: parse is not available for local collection '"+(_.classOf(this))+"'")},fetch:function(){throw new Error("Mixin.Backbone.LocalCollection: fetch is not available for local collection '"+(_.classOf(this))+"'")}}};Mixin.registerMixin(Mixin.Backbone.LocalCollection._mixin_info);var __bind=function(a,b){return function(){return a.apply(b,arguments)}};if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Timeouts: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.Timeouts||(Mixin.Timeouts={});Mixin.Timeouts._mixin_info={mixin_name:"Timeouts",initialize:function(){return Mixin.instanceData(this,"Timeouts",{timeouts:{}})},destroy:function(){return this.killAllTimeouts()},mixin_object:{addTimeout:function(b,f,d){var a,e,c;Mixin.Core._Validate.string(b,"Mixin.Timeouts.addTimeout","timeout_name");Mixin.Core._Validate.callback(f,"Mixin.Timeouts.addTimeout","callback");if(d===void 0){throw new Error("Mixin.Timeouts: missing wait on '"+(_.classOf(this))+"'")}if((typeof d!=="number")||(d<0)||(Math.floor(d)!==d)){throw new Error("Mixin.Timeouts: wait invalid on '"+(_.classOf(this))+"'")}e=Mixin.instanceData(this,"Timeouts");if(this.hasTimeout(b)){throw new Error("Mixin.Timeouts: timeout '"+b+"' already exists on '"+(_.classOf(this))+"'")}a=Array.prototype.slice.call(arguments,3);c=setTimeout((__bind(function(){this.killTimeout(b);return f.apply(this,a)},this)),d);e.timeouts[b]=c;return this},hasTimeout:function(a){var b;b=Mixin.instanceData(this,"Timeouts");return a in b.timeouts},timeoutCount:function(){var b,e,a,d,c;e=Mixin.instanceData(this,"Timeouts");b=0;c=e.timeouts;for(a in c){d=c[a];b++}return b},timeouts:function(){var e,b,a,d,c;e=Mixin.instanceData(this,"Timeouts");a=[];c=e.timeouts;for(b in c){d=c[b];a.push(b)}return a},killTimeout:function(a){var b;b=Mixin.instanceData(this,"Timeouts");if(!this.hasTimeout(a)){throw new Error("Mixin.Timeouts: timeout '"+a+"' does not exist. For a less-strict check, use killTimeoutIfExists")}this.killTimeoutIfExists(a);return this},killTimeoutIfExists:function(a){var c,b;c=Mixin.instanceData(this,"Timeouts");b=c.timeouts[a];if(b){clearTimeout(b)}delete c.timeouts[a];return this},killAllTimeouts:function(){var d,c,a,b;c=Mixin.instanceData(this,"Timeouts");b=c.timeouts;for(a in b){d=b[a];this.killTimeoutIfExists(a)}return this}}};Mixin.registerMixin(Mixin.Timeouts._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Subscriptions: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.Subscriptions||(Mixin.Subscriptions={});Mixin.Subscriptions._SubscriptionLink=(function(){function a(f,d,e,b){var c;this.subscription=f;this.subscriber=d;this.notification_callback=e;this.options=_.clone(b||{});c=Mixin.instanceData(this.subscriber,"Subscriber");c.subscription_backlinks.push(this)}a.prototype.mustKeepUntilDestroyed=function(){return(this.options.keep_until_destroyed===void 0)||!this.options.keep_until_destroyed};a.prototype.destroy=function(){var b;if(!this.subscription){throw new Error("Mixin.Subscriptions: _SubscriptionLink destroyed multiple times")}if(this.options.destroy){this.options.destroy();this.options.destroy=null}b=Mixin.instanceData(this.subscriber,"Subscriber");_.remove(b.subscription_backlinks,this);_.remove(this.subscription.subscription_links,this);this.subscription=null;this.subscriber=null;this.notification_callback=null;return this.options=null};return a})();Mixin.Subscription||(Mixin.Subscription={});Mixin.Subscription.TYPE={};Mixin.Subscription.TYPE.MULTIPLE=0;Mixin.Subscription.TYPE.EXCLUSIVE=1;Mixin.Subscriptions._Subscription=(function(){function a(c,b){this.observable=c;this.subscription_type=b;if(Mixin.DEBUG){if((typeof this.subscription_type!=="number")||(this.subscription_type<Mixin.Subscription.TYPE.MULTIPLE)||(this.subscription_type>Mixin.Subscription.TYPE.EXCLUSIVE)){throw new Error("Mixin.Subscriptions: Mixin.Subscription.TYPE is invalid")}}this.subscription_links=[]}a.prototype.addSubscriber=function(c,d,b){if(this.subscription_type===Mixin.Subscription.TYPE.EXCLUSIVE){this.removeSubscribers(function(e){return e.mustKeepUntilDestroyed()})}return this.subscription_links.push(new Mixin.Subscriptions._SubscriptionLink(this,c,d,b))};a.prototype.removeSubscriber=function(c,d,b){var e;e=_.find(this.subscription_links,function(f){return(c===f.subscriber)&&(d===f.notification_callback)});if(!e){throw new Error("Mixin.Subscriptions.removeSubscriber: subscription '"+b+"' does not exist for '"+(_.classOf(c))+"'")}_.remove(this.subscription_links,e);return e.destroy()};a.prototype.subscribers=function(g){var f,e,c,d,b;d=this.subscription_links;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(g.push(f.subscriber))}return b};a.prototype.notifySubscribers=function(){var d,g,f,c,e,b;d=Array.prototype.slice.call(arguments);e=this.subscription_links;b=[];for(f=0,c=e.length;f<c;f++){g=e[f];b.push(g.notification_callback.apply(g.subscriber,d))}return b};a.prototype.removeSubscribers=function(b){var d,j,h,f,i,c,g,e;if(b){d=_.select(this.subscription_links,b);if(d.length===0){return}this.subscription_links=_.difference(this.subscription_links,d);g=[];for(h=0,i=d.length;h<i;h++){j=d[h];g.push(j.destroy())}return g}else{d=this.subscription_links;this.subscription_links=[];e=[];for(f=0,c=d.length;f<c;f++){j=d[f];e.push(j.destroy())}return e}};a.prototype.destroy=function(){return _.remove(this.subscription_links,void 0,{callback:(function(b){return b.destroy()}),preclear:true})};return a})();Mixin.Subscriptions.Observable||(Mixin.Subscriptions.Observable={});Mixin.Subscriptions.Observable._mixin_info={mixin_name:"Observable",initialize:function(){var a,d,c,b;Mixin.instanceData(this,"Observable",{subscriptions:{},is_destroyed:false});b=[];for(d=0,c=arguments.length;d<c;d++){a=arguments[d];b.push(this.addSubscription.apply(this,_.isArray(a)?a:[a]))}return b},destroy:function(){var a;a=Mixin.instanceData(this,"Observable");if(a.is_destroyed){throw new Error("Mixin.Observable.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscriptions,void 0,{callback:(function(b){return b.destroy()})})},mixin_object:{hasSubscription:function(a){var b;if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.hasSubscription","subscription_name")}b=Mixin.instanceData(this,"Observable");return b.subscriptions.hasOwnProperty(a)},addSubscription:function(a,b){var c;c=Mixin.instanceData(this,"Observable");if(b===void 0){b=Mixin.Subscription.TYPE.MULTIPLE}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.addSubscription","subscription_name");Mixin.Core._Validate.noKey(c.subscriptions,a,"Mixin.Observable.addSubscription","subscription_name")}c.subscriptions[a]=new Mixin.Subscriptions._Subscription(this,b);return this},subscriptions:function(){var e,a,d,c,b;e=Mixin.instanceData(this,"Observable");d=[];b=e.subscriptions;for(a in b){c=b[a];d.push(a)}return d},subscribers:function(b){var g,a,e,c,d,f;e=[];g=Mixin.instanceData(this,"Observable");if(b===void 0){d=g.subscriptions;for(a in d){c=d[a];c.subscribers(e)}}else{if(!g.subscriptions.hasOwnProperty(b)){throw new Error("Mixin.Observable.subscribers: subscriber '"+(_classOf(this))+"' does not recognize '"+b+"'")}f=g.subscriptions;for(a in f){c=f[a];if(c.subscription_name===b){c.subscribers(e)}}}return _.uniq(e)},addSubscriber:function(h,d){var e,a,c,g,i,b,f;c=Mixin.instanceData(this,"Observable");i=function(k,m,j){var l;j||(j={});if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.addSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.addSubscriber","notification_callback");Mixin.Core._Validate.object(j,"Mixin.Observable.addSubscriber","options");if(j.destroy!==void 0){Mixin.Core._Validate.callback(j.destroy,"Mixin.Observable.addSubscriber","options.destroy")}}Mixin.Core._Validate.hasKey(c.subscriptions,k,"Mixin.Observable.addSubscriber","subscription_name");l=c.subscriptions[k];return l.addSubscriber(h,m,j)};e=Array.prototype.slice.call(arguments,1);Mixin.Core._Validate.instanceWithMixin(h,"Subscriber","Mixin.Observable.addSubscriber","subscriber");if(e.length>1){a=e[1];if(!((_.isString(a)&&this.hasSubscription(a))||(_.isArray(a)&&(a.length>=1)&&_.isString(a[0])&&this.hasSubscription(a[0])))){i.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(b=0,f=e.length;b<f;b++){g=e[b];if(_.isArray(g)){i.apply(this,g)}else{i.apply(g)}}return this},notifySubscribers:function(a){var c,b;c=Mixin.instanceData(this,"Observable");if(c.is_destroyed){return}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.notifySubscribers","subscription_name");Mixin.Core._Validate.hasKey(c.subscriptions,a,"Mixin.Observable.notifySubscribers")}b=c.subscriptions[a];if(!b){return}b.notifySubscribers.apply(b,Array.prototype.slice.call(arguments,1));return this},removeSubscriber:function(j,c,a){var g,d,f,i,b,e,h;f=Mixin.instanceData(this,"Observable");b=function(k,m){var l;if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.removeSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.removeSubscriber","notification_callback")}Mixin.Core._Validate.hasKey(f.subscriptions,k,"Mixin.Observable.removeSubscriber","subscription_name");l=f.subscriptions[k];return l.removeSubscriber(j,m,k)};g=Array.prototype.slice.call(arguments,1);if(Mixin.DEBUG){Mixin.Core._Validate.instanceWithMixin(j,"Subscriber","Mixin.Observable.removeSubscriber","subscriber")}if(g.length>1){d=g[1];if(!((_.isString(d)&&this.hasSubscription(d))||(_.isArray(d)&&(d.length>=1)&&_.isString(d[0])&&this.hasSubscription(d[0])))){b.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(e=0,h=g.length;e<h;e++){i=g[e];if(_.isArray(i)){b.apply(this,i)}else{b.apply(i)}}return this},removeSubscribers:function(b,e){var f,a,c,d;f=Mixin.instanceData(this,"Observable");if(Mixin.DEBUG){if(b!==void 0){Mixin.Core._Validate.string(b,"Mixin.Observable.removeSubscribers","subscription_name");Mixin.Core._Validate.hasKey(f.subscriptions,b,"Mixin.Observable.removeSubscribers")}if(e!==void 0){Mixin.Core._Validate.callback(e,"Mixin.Observable.removeSubscribers","test_fn")}}if(b){c=f.subscriptions[b];if(!c){return}c.removeSubscribers(e)}else{d=f.subscriptions;for(a in d){c=d[a];c.removeSubscribers(e)}}return this}}};Mixin.Subscriptions.Subscriber||(Mixin.Subscriptions.Subscriber={});Mixin.Subscriptions.Subscriber._mixin_info={mixin_name:"Subscriber",initialize:function(){return Mixin.instanceData(this,"Subscriber",{subscription_backlinks:[],is_destroyed:false})},destroy:function(){var a;a=Mixin.instanceData(this,"Subscriber");if(a.is_destroyed){throw new Error("Mixin.Subscriber.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscription_backlinks,void 0,{callback:(function(b){return b.destroy()}),preclear:true})},mixin_object:{observables:function(b){var h,d,j,f,e,i,a,g,c;h=Mixin.instanceData(this,"Subscriber");d=[];if(b===void 0){g=h.subscription_backlinks;for(f=0,i=g.length;f<i;f++){j=g[f];if(j.subscription&&(j.subscription.subscription_name===b)){d.push(j.subscription.observable)}}}else{if(Mixin.DEBUG){Mixin.Core._Validate.string(b,"Mixin.Subscriptions.observables","subscription_name")}c=h.subscription_backlinks;for(e=0,a=c.length;e<a;e++){j=c[e];if(j.subscription){d.push(j.subscription.observable)}}}return _.uniq(d)}}};Mixin.Subscriptions.ObservableSubscriber||(Mixin.Subscriptions.ObservableSubscriber={});Mixin.Subscriptions.ObservableSubscriber._mixin_info={mixin_name:"ObservableSubscriber",mixin_object:{},initialize:function(){return Mixin["in"](this,"Subscriber",["Observable"].concat(Array.prototype.slice.call(arguments)))},destroy:function(){return Mixin.out(this,"Subscriber","Observable")}};Mixin.registerMixin(Mixin.Subscriptions.Observable._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.Subscriber._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.ObservableSubscriber._mixin_info);
+var _;var __bind=function(a,b){return function(){return a.apply(b,arguments)}},__hasProp=Object.prototype.hasOwnProperty,__extends=function(d,b){for(var a in b){if(__hasProp.call(b,a)){d[a]=b[a]}}function c(){this.constructor=d}c.prototype=b.prototype;d.prototype=new c;d.__super__=b.prototype;return d};this.Mixin||(this.Mixin={});this.Mixin.Core||(this.Mixin.Core={});Mixin.VERSION="0.1.1";_||(_={});if(!_.isArray){_.isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"}}if(!_.isString){_.isString=function(a){return !!(a===""||(a&&a.charCodeAt&&a.substr))}}if(!_.isFunction){_.isFunction=function(a){return !!(a&&a.constructor&&a.call&&a.apply)}}if(!_.isEmpty){_.isEmpty=function(c){var a,b;if(_.isArray(c)||_.isString(c)){return c.length===0}for(a in c){b=c[a];return false}return true}}if(!_.classOf){_.classOf=function(a){if(!(a instanceof Object)){return}if(a.prototype&&a.prototype.constructor&&a.prototype.constructor.name){return a.prototype.constructor.name}if(a.constructor&&a.constructor.name){return a.constructor.name}}}if(!_.size){_.size=function(c){var b,a;b=0;for(a in c){b++}return b}}if(!_.find){_.find=function(e,b){var c,d,a;for(d=0,a=e.length;d<a;d++){c=e[d];if(b(c)){return c}}return null}}Mixin.Core._Validate=(function(){function a(){}a.mixinInfo=function(b,d,c){if(!b){throw new Error(""+c+": mixin_info missing")}a.string(b.mixin_name,c,"mixin_name");if(!d&&Mixin.Core._Manager.available_mixins.hasOwnProperty(b.mixin_name)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' already registered")}if(!b.mixin_object){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' missing mixin_object")}if(!(b.mixin_object instanceof Object)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' mixin_object is invalid")}if(b.initialize&&!_.isFunction(b.initialize)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' initialize function is invalid")}if(b.destroy&&!_.isFunction(b.destroy)){throw new Error(""+c+": mixin_info '"+b.mixin_name+"' destroy function is invalid")}};a.instanceAndMixinName=function(c,d,b){if(!c){throw new Error(""+b+": mix_target missing")}a.string(d,b,"mixin_name");return a.instanceOrArray(c,b,"mix_target",d)};a.classConstructorAndMixinName=function(c,d,b){if(!c){throw new Error(""+b+": class constructor missing")}a.string(d,b,"mixin_name");if(!_.isFunction(c)){throw new Error(""+b+": class constructor invalid for '"+d+"'")}};a.exists=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}};a.object=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof d!=="object")||_.isArray(d)){throw new Error(""+b+": "+c+" invalid")}};a.uint=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!(typeof d!=="number")||(d<0)||(Math.floor(d)!==d)){throw new Error(""+b+": "+c+" invalid")}};a.string=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!_.isString(d)){throw new Error(""+b+": "+c+" invalid")}};a.stringArrayOrNestedStringArray=function(h,d,e){var f,g,c,b;if(h===void 0){throw new Error(""+d+": "+e+" missing")}if(!_.isArray(h)){throw new Error(""+d+": "+e+" invalid")}b=[];for(g=0,c=string_or_array.length;g<c;g++){f=string_or_array[g];b.push(((function(){if(_.isArray(f)&&(!f.length||!_.isString(f[0]))||!_.isString(f)){throw new Error(""+d+": "+e+" invalid")}})()))}return b};a.callback=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if(!_.isFunction(d)){throw new Error(""+b+": "+c+" invalid")}};a.instance=function(d,b,c){if(d===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof d!=="object"||_.isArray(d))||!_.isFunction(d.constructor)||(d.constructor.name==="Object")){throw new Error(""+b+": "+c+" invalid")}};a.instanceOrArray=function(e,b,c,d){if(e===void 0){throw new Error(""+b+": "+c+" missing")}if((typeof e!=="object")||!_.isFunction(e.constructor)||(e.constructor.name==="Object")||_.isArray(e)){throw new Error(""+b+": "+c+" invalid")}};a.instanceWithMixin=function(e,d,b,c){a.instance(e,b,c);if(!Mixin.hasMixin(e,d)){throw new Error(""+b+": "+c+" missing mixin '"+d+"' on "+(_.classOf(e)))}};a.noKey=function(e,d,b,c){if(e.hasOwnProperty(d)){throw new Error(""+b+": "+d+" already exists for "+c)}};a.hasKey=function(e,d,b,c){if(!e.hasOwnProperty(d)){throw new Error(""+b+": "+d+" does not exist for "+c)}};return a})();Mixin.Core._InstanceRecord=(function(){function a(b){this.mix_target=b;this.initialized_mixins={}}a.prototype.destroy=function(){if(!_.isEmpty(this.initialized_mixins)){throw new Error("Mixin: non-empty instance record being destroyed")}if(this.backbone_destroy_fn){this.mix_target.unbind("destroy",this.backbone_destroy_fn);this.backbone_destroy_fn=null}return this.mix_target=null};a.prototype.hasMixin=function(d,c){var b;b=this.initialized_mixins.hasOwnProperty(d);if(b||!c){return b}this.initialized_mixins[d]={is_destroyed:false};if(Mixin.UNMIX_ON_BACKBONE_DESTROY&&(mixin_info.mixin_name==="Backbone.Events")&&!this.backbone_destroy_fn){this.backbone_destroy_fn=this._bindBackboneDestroyFn(this.mix_target);this.mix_target.bind("destroy",this.backbone_destroy_fn)}return true};a.prototype.collectMixins=function(d){var e,c,f,b;f=this.initialized_mixins;b=[];for(e in f){c=f[e];b.push(d.push(e))}return b};a.prototype.initializeMixin=function(b,c){this.initialized_mixins[b.mixin_name]={is_destroyed:false,destroy:b.destroy};if(b.initialize){b.initialize.apply(this.mix_target,c)}if(Mixin.UNMIX_ON_BACKBONE_DESTROY&&(b.mixin_name==="Backbone.Events")&&!this.backbone_destroy_fn){this.backbone_destroy_fn=this._bindBackboneDestroyFn(this.mix_target);return this.mix_target.bind("destroy",this.backbone_destroy_fn)}};a.prototype.destroyMixin=function(f){var c,b,e,d;if(f){if(!this.initialized_mixins.hasOwnProperty(f)){return false}return this._destroyMixinInfo(f)}else{b=false;d=this.initialized_mixins;for(c in d){e=d[c];b=true;this._destroyMixinInfo(c)}return b}};a.prototype._destroyMixinInfo=function(c){var b;b=this.initialized_mixins[c];if(b.is_destroyed){return true}b.is_destroyed=true;if(b.destroy){b.destroy.apply(this.mix_target);b.destroy=null}Mixin.Core._Manager._destroyInstanceData(this.mix_target,c);delete this.initialized_mixins[c];return true};a.prototype._bindBackboneDestroyFn=function(b){return __bind(function(){return Mixin.out(b)},this)};return a})();Mixin.Core._ClassRecord=(function(){function a(b){this.constructor=b;this.mixins={};this.instance_records=[]}a.prototype.mixIntoClass=function(d,b){var c,f,e;if(this.mixins.hasOwnProperty(b.mixin_name)){return}this.mixins[b.mixin_name]=b;if(!b.force){e=b.mixin_object;for(c in e){f=e[c];if(c in d){throw new Error("Mixin: property '"+c+"' clashes with existing property on '"+(_.classOf(d)))}}}return __extends(d.constructor.prototype,b.mixin_object)};a.prototype.classHasMixin=function(b){return this.mixins.hasOwnProperty(b)};a.prototype.instanceHasMixin=function(c,e,d){var b;b=this._getInstanceRecord(c);if(d){if(!this.mixins.hasOwnProperty(e)){this.mixins[e]=Mixin.Core._Manager._getMixinInfo(e)}if(!b){b=new Mixin.Core._InstanceRecord(c);this.instance_records.push(b)}return b.hasMixin(e,d)}else{if(b){return b.hasMixin(e)}else{return false}}};a.prototype.collectMixinsForInstance=function(b,d){var c;c=this._getInstanceRecord(d);if(!c){return}return c.collectMixins(b)};a.prototype.initializeInstance=function(e,b,d){var c;c=this._getInstanceRecord(e);if(c){c.initializeMixin(b,d);return}c=new Mixin.Core._InstanceRecord(e);this.instance_records.push(c);return c.initializeMixin(b,d)};a.prototype.destroyInstance=function(e,f){var d,c,b;if(f&&!this.mixins.hasOwnProperty(f)){return false}b=false;d=this.instance_records.length-1;while(d>=0){c=this.instance_records[d];if((c.mix_target===e)&&c.destroyMixin(f)){b=true;if(_.isEmpty(c.initialized_mixins)){c.destroy();this.instance_records.splice(d,1)}if(f){return true}}d--}return b};a.prototype._getInstanceRecord=function(d){var c,f,b,e;e=this.instance_records;for(f=0,b=e.length;f<b;f++){c=e[f];if(c.mix_target===d){return c}}};return a})();Mixin.Core._Manager=(function(){function a(){}a.available_mixins={};a.registerMixin=function(b,c){if(Mixin.DEBUG){Mixin.Core._Validate.mixinInfo(b,c,"Mixin.registerMixin")}a.available_mixins[b.mixin_name]=b;return true};a.isAvailable=function(b){return a.available_mixins.hasOwnProperty(b)};a._getMixinInfo=function(b){return a.available_mixins[b]};a.mixin=function(e){var d,h,g,c,f,b;c=__bind(function(k,l,m){var j,i;if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(k,l,"Mixin.mixin","mix_target");if(!this.isAvailable(l)){throw new Error("Mixin.mixin: '"+l+"' not found")}}i=a.available_mixins[l];if(!i){throw new Error("Mixin.mixin: '"+l+"' not found")}if(this.hasMixin(k,i.mixin_name)){return}j=a._findOrCreateClassRecord(k,i);j.mixIntoClass(k,i);return j.initializeInstance(k,i,Array.prototype.slice.call(arguments,2))},this);d=Array.prototype.slice.call(arguments,1);if(!d.length){throw new Error("Mixin: mixin_name missing")}if(d.length>1){h=d[1];if(!((_.isString(h)&&a.isAvailable(h))||(_.isArray(h)&&(h.length>=1)&&_.isString(h[0])&&a.isAvailable(h[0])))){c.apply(this,arguments);return e}}for(f=0,b=d.length;f<b;f++){g=d[f];if(_.isArray(g)){c.apply(this,[e].concat(g))}else{c(e,g)}}return e};a.mixout=function(i,e){var h,k,l,f,d,j,b,g,c;if(Mixin.DEBUG){Mixin.Core._Validate.instance(i,"Mixin.mixout","mix_target")}l=__bind(function(o,r){var n,q,m,p;if(Mixin.DEBUG){Mixin.Core._Validate.string(r,"Mixin.mixout","mixin_name")}if(o.constructor._mixin_class_records){p=o.constructor._mixin_class_records;for(q=0,m=p.length;q<m;q++){n=p[q];if(n.destroyInstance(o,r)){return o}}}return o},this);if(arguments.length>1){g=Array.prototype.slice.call(arguments,1);for(f=0,j=g.length;f<j;f++){k=g[f];l(i,k)}}else{if(i.constructor._mixin_class_records){c=i.constructor._mixin_class_records;for(d=0,b=c.length;d<b;d++){h=c[d];if(h.destroyInstance(i)){return i}}}}return i};a.hasMixin=function(d,f,e){var c,b;if(e){if(a.hasMixin(d,f)){return true}b=a.available_mixins[f];if(!b){return false}c=a._findOrCreateClassRecord(d,b);return c.instanceHasMixin(d,f,e)}else{if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(d,f,"Mixin.hasMixin","mix_target")}if(a.hasInstanceData(d,f)){return true}c=a._findClassRecord(d,f);if(!c){return false}return c.instanceHasMixin(d,f)}};a.mixins=function(e){var d,c,g,b,f;if(Mixin.DEBUG){Mixin.Core._Validate.instance(e,c,"Mixin.mixins","mix_target")}c=[];if(e.constructor._mixin_class_records){f=e.constructor._mixin_class_records;for(g=0,b=f.length;g<b;g++){d=f[g];d.collectMixinsForInstance(c,e)}}return c};a._getClassRecords=function(e){var d,h,c,g,b,f;h=[];c=e.constructor;while(c){if(c._mixin_class_records){f=c._mixin_class_records;for(g=0,b=f.length;g<b;g++){d=f[g];if(e instanceof d.constructor){h.push(d)}}}c=c.__super__&&(c.__super__.constructor!==c)?c.__super__.constructor:void 0}return h};a._findClassRecord=function(d,f){var c,g,e,b;g=this._getClassRecords(d);for(e=0,b=g.length;e<b;e++){c=g[e];if(c.classHasMixin(f)){return c}}};a._findOrCreateClassRecord=function(g,d){var f,e,c,b,h;f=a._findClassRecord(g,d.mixin_name);if(f){return f}if(g.constructor._mixin_class_records){f=_.find(g.constructor._mixin_class_records,function(i){return i.constructor===g.constructor})}if(!f){f=new Mixin.Core._ClassRecord(g.constructor);if(g.constructor._mixin_class_records){h=false;e=0;c=g.constructor._mixin_class_records.length;while(e<c){b=g.constructor._mixin_class_records[e];if(g instanceof b.constructor){g.constructor._mixin_class_records.splice(e,0,f);h=true;break}e++}if(!h){g.constructor._mixin_class_records.push(f)}}else{g.constructor._mixin_class_records=[f]}if(Mixin._statistics){Mixin._statistics.addClassRecord(f)}}return f};a.hasInstanceData=function(b,c){if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(b,c,"Mixin.hasInstanceData","mix_target")}return !!(b._mixin_data&&b._mixin_data.hasOwnProperty(c))};a.instanceData=function(b,d,c){if(Mixin.DEBUG){Mixin.Core._Validate.instanceAndMixinName(b,d,"Mixin.instanceData","mix_target");if(c===void 0){if(!("_mixin_data" in b)){throw new Error("Mixin.instanceData: no instance data on '"+(_.classOf(b))+"'")}if(!b._mixin_data.hasOwnProperty(d)){throw new Error("Mixin.instanceData: mixin '"+d+"' instance data not found on '"+(_.classOf(b))+"'")}}else{if(!a.hasMixin(b,d)){throw new Error("Mixin.instanceData: mixin '"+d+"' not mixed into '"+(_.classOf(b))+"'")}}}if(!(c===void 0)){if(!b._mixin_data){b._mixin_data={}}b._mixin_data[d]=c}return b._mixin_data[d]};a._destroyInstanceData=function(b,d){var c;if(!b._mixin_data){return}c=b._mixin_data[d];delete b._mixin_data[d];if(_.isEmpty(b._mixin_data)){return delete b._mixin_data}};return a})();Mixin.registerMixin=Mixin.Core._Manager.registerMixin;Mixin.isAvailable=Mixin.Core._Manager.isAvailable;Mixin.mixin=Mixin["in"]=Mixin.Core._Manager.mixin;Mixin.mixout=Mixin.out=Mixin.Core._Manager.mixout;Mixin.hasMixin=Mixin.exists=Mixin.Core._Manager.hasMixin;Mixin.mixins=Mixin.Core._Manager.mixins;Mixin.hasInstanceData=Mixin.hasID=Mixin.Core._Manager.hasInstanceData;Mixin.instanceData=Mixin.iD=Mixin.Core._Manager.instanceData;if(typeof exports!=="undefined"){exports.Mixin=Mixin}if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Core.Statistics: Dependency alert! Mixin is missing. Please ensure it is included")}if(this.Mixin.STATISTICS===void 0){this.Mixin.STATISTICS=true}Mixin.Core.Statistics=(function(){function a(){this.class_records=[]}a.prototype.addClassRecord=function(b){return this.class_records.push(b)};a.prototype.purge=function(){this.class_records=[];return this.clear()};a.prototype.clear=function(){this.by_instance_with_data=null;this.by_instance_get_mixins=null;this.by_mixin_get_instances=null;this.by_mixin_get_constructors=null;return this.by_constructor_get_instances=null};a.prototype.update=function(){this.clear();this.byInstance_getMixins();this.byInstance_withData();this.byMixin_getInstances();this.byMixin_getConstructors();return this.byConstructor_getInstances()};a.prototype.byInstance_getMixins=function(){var c,e,b,d;if(!this.by_instance_get_mixins){this.by_instance_get_mixins=[];d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetMixinsByInstance(c,this.by_instance_get_mixins)}}return this.by_instance_get_mixins};a.prototype.byInstance_withData=function(){var c,e,b,d;if(!this.by_instance_with_data){this.by_instance_with_data=[];d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetInstancesWithData(c,this.by_instance_with_data)}}return this.by_instance_with_data};a.prototype.byMixin_getInstances=function(){var c,e,b,d;if(!this.by_mixin_get_instances){this.by_mixin_get_instances={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetInstancesByMixin(c,this.by_mixin_get_instances)}}return this.by_mixin_get_instances};a.prototype.byMixin_getConstructors=function(){var c,e,b,d;if(!this.by_mixin_get_constructors){this.by_mixin_get_constructors={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGetMixins(c,this.by_mixin_get_constructors)}}return this.by_mixin_get_constructors};a.prototype.byConstructor_getInstances=function(){var c,e,b,d;if(!this.by_constructor_get_instances){this.by_constructor_get_instances={};d=this.class_records;for(e=0,b=d.length;e<b;e++){c=d[e];this.classRecordGroupInstances(c,this.by_constructor_get_instances)}}return this.by_constructor_get_instances};a.prototype.classRecordGetInstancesWithData=function(e,h){var d,g,c,f,b;f=e.instance_records;b=[];for(g=0,c=f.length;g<c;g++){d=f[g];b.push((d.mix_target&&d.mix_target._mixin_data?h.push(d.mix_target):void 0))}return b};a.prototype.classRecordGetInstancesByMixin=function(f,g){var j,i,b,d,h,e,c;if(!f.instance_records.length){return}e=f.instance_records;c=[];for(d=0,h=e.length;d<h;d++){j=e[d];c.push((function(){var l,k;l=j.initialized_mixins;k=[];for(i in l){b=l[i];k.push((!g.hasOwnProperty(i)?g[i]=[]:void 0,g[i].push(j.mix_target)))}return k})())}return c};a.prototype.classRecordGetMixinsByInstance=function(h,b){var l,k,c,i,f,j,g,d,e;g=h.instance_records;e=[];for(f=0,j=g.length;f<j;f++){l=g[f];i=[];d=l.initialized_mixins;for(k in d){c=d[k];i.push(k)}e.push(b.push({instance:l.mix_target,mixins:i}))}return e};a.prototype.classRecordGroupInstances=function(e,h){var d,g,c,f,b;if(!e.instance_records.length){return}if(!h.hasOwnProperty(e.constructor.name)){h[e.constructor]=[]}f=e.instance_records;b=[];for(g=0,c=f.length;g<c;g++){d=f[g];b.push(h[e.constructor].push(d.mix_target))}return b};a.prototype.classRecordGetMixins=function(g,d,e){var f,c,h,b;h=g.mixins;b=[];for(f in h){c=h[f];b.push((!d.hasOwnProperty(f)?d[f]=[]:void 0,d[f].push(g.constructor)))}return b};return a})();if(this.Mixin.STATISTICS){Mixin._statistics=new Mixin.Core.Statistics()}if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Backbone.Events: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Backbone.Events: Dependency alert! Underscore.js must be included before this file")}if(!this.Backbone||!this.Backbone.Events){throw new Error("Mixin.Backbone.Events: Dependency alert! Backbone.js must be included before this file")}Mixin.Backbone||(Mixin.Backbone={});Mixin.Backbone.Events||(Mixin.Backbone.Events={});Mixin.Backbone.Events._mixin_info={mixin_name:"Backbone.Events",mixin_object:Backbone.Events};Mixin.Backbone.Events.autoMarkNative=function(){var b,c,d,a;b=Backbone.Collection.prototype.initialize;Backbone.Collection.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return b.apply(this,arguments)};c=Backbone.Model.prototype.initialize;Backbone.Model.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return c.apply(this,arguments)};a=Backbone.View.prototype.initialize;Backbone.View.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return a.apply(this,arguments)};d=Backbone.Router.prototype.initialize;return Backbone.Router.prototype.initialize=function(){Mixin.hasMixin(this,"Backbone.Events",true);return d.apply(this,arguments)}};Mixin.registerMixin(Mixin.Backbone.Events._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.RefCount: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.RefCount||(Mixin.RefCount={});Mixin.RefCount._mixin_info={mixin_name:"RefCount",initialize:function(a){return Mixin.instanceData(this,"RefCount",{ref_count:1,release_callback:a})},mixin_object:{retain:function(){var a;a=Mixin.instanceData(this,"RefCount");if(a.ref_count<=0){throw new Error("Mixin.RefCount: ref_count is corrupt: "+a.ref_count)}a.ref_count++;return this},release:function(){var a;a=Mixin.instanceData(this,"RefCount");if(a.ref_count<=0){throw new Error("Mixin.RefCount: ref_count is corrupt: "+a.ref_count)}a.ref_count--;if((a.ref_count===0)&&a.release_callback){a.release_callback(this)}return this},refCount:function(){return Mixin.instanceData(this,"RefCount").ref_count}}};Mixin.registerMixin(Mixin.RefCount._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Flags: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.Flags||(Mixin.Flags={});Mixin.Flags._mixin_info={mixin_name:"Flags",initialize:function(a,b){if(a==null){a=0}return Mixin.instanceData(this,"Flags",{flags:a,change_callback:b})},mixin_object:{flags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");if(a!==void 0){b=c.flags;c.flags=a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}}return c.flags},hasFlags:function(a){var b;b=Mixin.instanceData(this,"Flags");return !!(b.flags&a)},setFlags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");b=c.flags;c.flags|=a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}return c.flags},resetFlags:function(a){var c,b;c=Mixin.instanceData(this,"Flags");b=c.flags;c.flags&=~a;if(c.change_callback&&(b!==c.flags)){c.change_callback(c.flags)}return c.flags}}};Mixin.registerMixin(Mixin.Flags._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.AutoMemory: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.AutoMemory: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.AutoMemory: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.AutoMemory||(Mixin.AutoMemory={});Mixin.AutoMemory.root=this;Mixin.AutoMemory.WRAPPER=Mixin.AutoMemory.root["$"]?$:"$";Mixin.AutoMemory.Property=(function(){function a(b){this.owner=b}a.prototype.setArgs=function(){var f,e,c,d,b;if(!arguments.length){throw new Error("Mixin.AutoMemory: missing key")}this.args=Array.prototype.slice.call(arguments);if(!Mixin.DEBUG){return this}if(_.isArray(this.args[0])){d=this.args;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(this._validateEntry(f))}return b}else{return this._validateEntry(this.args)}};a.prototype.destroy=function(){var f,e,c,d,b;if(_.isArray(this.args[0])){d=this.args;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(this._destroyEntry(f))}return b}else{return this._destroyEntry(this.args)}};a.prototype._validateEntry=function(d){var c,b;b=d[0];c=d.length>1?d[1]:void 0;if(!_.keypathExists(this.owner,b)){throw new Error("Mixin.AutoMemory: property '"+b+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}if(c&&!(_.isFunction(c)||_.isString(c))){throw new Error("Mixin.AutoMemory: unexpected function reference for property '"+b+"' on '"+(_.classOf(this.owner))+"'")}};a.prototype._destroyEntry=function(g){var b,i,j,h,f,c,e,d;i=g[0];b=g.length>1?g[1]:void 0;if(!b){j=_.keypathValueOwner(this.owner,i);if(!j){throw new Error("Mixin.AutoMemory: property '"+i+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}j[i]=null;return}f=_.keypath(this.owner,i);if(!f){return}if(_.isFunction(b)){b.apply(this.owner,[f].concat(g.length>2?g.slice(2):[]))}else{if(_.isFunction(f[b])){f[b].apply(f,g.length>2?g.slice(2):[])}else{d=g.slice(1);for(c=0,e=d.length;c<e;c++){h=d[c];this._destroyEntry([h])}}}return _.keypath(this.owner,i,null)};return a})();Mixin.AutoMemory.WrappedProperty=(function(){function a(b,d,e,h){var g,c,f;this.owner=b;this.key=d;this.fn_ref=e;this.wrapper=h;if(this.fn_ref&&_.isArray(this.fn_ref)){if(Mixin.DEBUG&&!this.fn_ref.length){throw new Error("Mixin.AutoMemory: unexpected function reference")}this.args=this.fn_ref.splice(1);this.fn_ref=this.fn_ref[0]}if(!Mixin.DEBUG){return this}if(!this.key){throw new Error("Mixin.AutoMemory: missing key")}if(_.isArray(this.key)){f=this.key;for(g=0,c=f.length;g<c;g++){d=f[g];if(!_.keypathExists(this.owner,d)){throw new Error("Mixin.AutoMemory: property '"+d+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}}}else{if(!_.keypathExists(this.owner,this.key)){throw new Error("Mixin.AutoMemory: property '"+this.key+"' doesn't exist on '"+(_.classOf(this.owner))+"'")}}if(this.fn_ref&&!(_.isFunction(this.fn_ref)||_.isString(this.fn_ref))){throw new Error("Mixin.AutoMemory: unexpected function reference")}if(!this.wrapper){throw new Error("Mixin.AutoMemory: missing wrapper")}}a.prototype.destroy=function(){var d,f,c,e,b;if(_.isArray(this.key)){e=this.key;b=[];for(f=0,c=e.length;f<c;f++){d=e[f];b.push(this._destroyKey(d))}return b}else{return this._destroyKey(this.key)}};a.prototype._destroyKey=function(b){var d,c,e;if(!this.fn_ref){_.keypath(this.owner,b,null);return}d=_.keypath(this.owner,b);if(!d){return}e=_.isString(this.wrapper)?Mixin.AutoMemory.root[this.wrapper]:this.wrapper;c=e(d);if(_.isFunction(this.fn_ref)){this.fn_ref.apply(this.owner,[c].concat(this.args?this.args.slice():[]))}else{if(Mixin.DEBUG&&!_.isFunction(c[this.fn_ref])){throw new Error("Mixin.AutoMemory: function '"+this.fn_ref+"' missing for wrapped property '"+b+"' on '"+(_.classOf(this.owner))+"'")}c[this.fn_ref].apply(c,this.args)}return _.keypath(this.owner,b,null)};return a})();Mixin.AutoMemory.Function=(function(){function a(c,d,b){this.object=c;this.fn_ref=d;this.args=b;if(!Mixin.DEBUG){return this}if(!this.fn_ref){throw new Error("Mixin.AutoMemory: missing fn_ref")}if(!_.isFunction(this.fn_ref)&&!(this.object&&_.isString(this.fn_ref)&&_.isFunction(this.object[this.fn_ref]))){throw new Error("Mixin.AutoMemory: unexpected function reference")}}a.prototype.destroy=function(){if(!this.object){this.fn_ref.apply(null,this.args);return}if(!_.isFunction(this.fn_ref)){this.object[this.fn_ref].apply(this.object,this.args);return}return this.fn_ref.apply(this.object,[this.object].concat(this.args?this.args.slice():[]))};return a})();Mixin.AutoMemory._mixin_info={mixin_name:"AutoMemory",initialize:function(){return Mixin.instanceData(this,"AutoMemory",[])},destroy:function(){var e,c,d,b,a;c=Mixin.instanceData(this,"AutoMemory");Mixin.instanceData(this,"AutoMemory",[]);a=[];for(d=0,b=c.length;d<b;d++){e=c[d];a.push(e.destroy())}return a},mixin_object:{autoProperty:function(b,c){var a;a=new Mixin.AutoMemory.Property(this);a.setArgs.apply(a,arguments);Mixin.instanceData(this,"AutoMemory").push(a);return this},autoWrappedProperty:function(a,b,c){if(c===void 0){c=Mixin.AutoMemory.WRAPPER}Mixin.instanceData(this,"AutoMemory").push(new Mixin.AutoMemory.WrappedProperty(this,a,b,c));return this},autoFunction:function(a,b){Mixin.instanceData(this,"AutoMemory").push(new Mixin.AutoMemory.Function(a,b,Array.prototype.slice.call(arguments,2)));return this}}};Mixin.registerMixin(Mixin.AutoMemory._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Underscore.js must be included before this file")}if(!this.Backbone){throw new Error("Mixin.Backbone.LocalCollection: Dependency alert! Backbone.js must be included before this file")}Mixin.Backbone||(Mixin.Backbone={});Mixin.Backbone.LocalCollection||(Mixin.Backbone.LocalCollection={});Mixin.Backbone.LocalCollection._mixin_info={mixin_name:"Backbone.LocalCollection",force:true,initialize:function(){if(!(this instanceof Backbone.Collection)){throw new Error("Mixin.Backbone.LocalCollection: the mix_target '"+(_.classOf(this))+"' is not a Backbone.Collection")}},mixin_object:{_add:function(b,a){if(!b.id&&b.cid){b.id=b.cid}return this.constructor.__super__._add.apply(this,arguments)},url:function(){throw new Error("Mixin.Backbone.LocalCollection: url is not available for local collection '"+(_.classOf(this))+"'")},parse:function(a){throw new Error("Mixin.Backbone.LocalCollection: parse is not available for local collection '"+(_.classOf(this))+"'")},fetch:function(){throw new Error("Mixin.Backbone.LocalCollection: fetch is not available for local collection '"+(_.classOf(this))+"'")}}};Mixin.registerMixin(Mixin.Backbone.LocalCollection._mixin_info);var __bind=function(a,b){return function(){return a.apply(b,arguments)}};if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Timeouts: Dependency alert! Mixin is missing. Please ensure it is included")}Mixin.Timeouts||(Mixin.Timeouts={});Mixin.Timeouts._mixin_info={mixin_name:"Timeouts",initialize:function(){return Mixin.instanceData(this,"Timeouts",{timeouts:{}})},destroy:function(){return this.killAllTimeouts()},mixin_object:{addTimeout:function(b,f,d){var a,e,c;Mixin.Core._Validate.string(b,"Mixin.Timeouts.addTimeout","timeout_name");Mixin.Core._Validate.callback(f,"Mixin.Timeouts.addTimeout","callback");if(d===void 0){throw new Error("Mixin.Timeouts: missing wait on '"+(_.classOf(this))+"'")}if((typeof d!=="number")||(d<0)||(Math.floor(d)!==d)){throw new Error("Mixin.Timeouts: wait invalid on '"+(_.classOf(this))+"'")}e=Mixin.instanceData(this,"Timeouts");if(this.hasTimeout(b)){throw new Error("Mixin.Timeouts: timeout '"+b+"' already exists on '"+(_.classOf(this))+"'")}a=Array.prototype.slice.call(arguments,3);c=setTimeout((__bind(function(){this.killTimeout(b);return f.apply(this,a)},this)),d);e.timeouts[b]=c;return this},hasTimeout:function(a){var b;b=Mixin.instanceData(this,"Timeouts");return a in b.timeouts},timeoutCount:function(){var b,e,a,d,c;e=Mixin.instanceData(this,"Timeouts");b=0;c=e.timeouts;for(a in c){d=c[a];b++}return b},timeouts:function(){var e,b,a,d,c;e=Mixin.instanceData(this,"Timeouts");a=[];c=e.timeouts;for(b in c){d=c[b];a.push(b)}return a},killTimeout:function(a){var b;b=Mixin.instanceData(this,"Timeouts");if(!this.hasTimeout(a)){throw new Error("Mixin.Timeouts: timeout '"+a+"' does not exist. For a less-strict check, use killTimeoutIfExists")}this.killTimeoutIfExists(a);return this},killTimeoutIfExists:function(a){var c,b;c=Mixin.instanceData(this,"Timeouts");b=c.timeouts[a];if(b){clearTimeout(b)}delete c.timeouts[a];return this},killAllTimeouts:function(){var d,c,a,b;c=Mixin.instanceData(this,"Timeouts");b=c.timeouts;for(a in b){d=b[a];this.killTimeoutIfExists(a)}return this}}};Mixin.registerMixin(Mixin.Timeouts._mixin_info);if(!Mixin&&(typeof exports!=="undefined")){this.Mixin=require("mixin_core").Mixin}if(!Mixin){throw new Error("Mixin.Subscriptions: Dependency alert! Mixin is missing. Please ensure it is included")}if(!_.VERSION){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore.js must be included before this file")}if(!_.AWESOMENESS){throw new Error("Mixin.Subscriptions: Dependency alert! Underscore-Awesomer.js must be included before this file")}Mixin.Subscriptions||(Mixin.Subscriptions={});Mixin.Subscriptions._SubscriptionLink=(function(){function a(f,d,e,b){var c;this.subscription=f;this.subscriber=d;this.notification_callback=e;this.options=_.clone(b||{});c=Mixin.instanceData(this.subscriber,"Subscriber");c.subscription_backlinks.push(this)}a.prototype.mustKeepUntilDestroyed=function(){return(this.options.keep_until_destroyed===void 0)||!this.options.keep_until_destroyed};a.prototype.destroy=function(){var b;if(!this.subscription){throw new Error("Mixin.Subscriptions: _SubscriptionLink destroyed multiple times")}if(this.options.destroy){this.options.destroy();this.options.destroy=null}b=Mixin.instanceData(this.subscriber,"Subscriber");_.remove(b.subscription_backlinks,this);_.remove(this.subscription.subscription_links,this);this.subscription=null;this.subscriber=null;this.notification_callback=null;return this.options=null};return a})();Mixin.Subscription||(Mixin.Subscription={});Mixin.Subscription.TYPE={};Mixin.Subscription.TYPE.MULTIPLE=0;Mixin.Subscription.TYPE.EXCLUSIVE=1;Mixin.Subscriptions._Subscription=(function(){function a(c,b){this.observable=c;this.subscription_type=b;if(Mixin.DEBUG){if((typeof this.subscription_type!=="number")||(this.subscription_type<Mixin.Subscription.TYPE.MULTIPLE)||(this.subscription_type>Mixin.Subscription.TYPE.EXCLUSIVE)){throw new Error("Mixin.Subscriptions: Mixin.Subscription.TYPE is invalid")}}this.subscription_links=[]}a.prototype.addSubscriber=function(c,d,b){if(this.subscription_type===Mixin.Subscription.TYPE.EXCLUSIVE){this.removeSubscribers(function(e){return e.mustKeepUntilDestroyed()})}return this.subscription_links.push(new Mixin.Subscriptions._SubscriptionLink(this,c,d,b))};a.prototype.removeSubscriber=function(c,d,b){var e;e=_.find(this.subscription_links,function(f){return(c===f.subscriber)&&(d===f.notification_callback)});if(!e){throw new Error("Mixin.Subscriptions.removeSubscriber: subscription '"+b+"' does not exist for '"+(_.classOf(c))+"'")}_.remove(this.subscription_links,e);return e.destroy()};a.prototype.subscribers=function(g){var f,e,c,d,b;d=this.subscription_links;b=[];for(e=0,c=d.length;e<c;e++){f=d[e];b.push(g.push(f.subscriber))}return b};a.prototype.notifySubscribers=function(){var d,g,f,c,e,b;d=Array.prototype.slice.call(arguments);e=this.subscription_links;b=[];for(f=0,c=e.length;f<c;f++){g=e[f];b.push(g.notification_callback.apply(g.subscriber,d))}return b};a.prototype.removeSubscribers=function(b){var d,j,h,f,i,c,g,e;if(b){d=_.select(this.subscription_links,b);if(d.length===0){return}this.subscription_links=_.difference(this.subscription_links,d);g=[];for(h=0,i=d.length;h<i;h++){j=d[h];g.push(j.destroy())}return g}else{d=this.subscription_links;this.subscription_links=[];e=[];for(f=0,c=d.length;f<c;f++){j=d[f];e.push(j.destroy())}return e}};a.prototype.destroy=function(){return _.remove(this.subscription_links,void 0,{callback:(function(b){return b.destroy()}),preclear:true})};return a})();Mixin.Subscriptions.Observable||(Mixin.Subscriptions.Observable={});Mixin.Subscriptions.Observable._mixin_info={mixin_name:"Observable",initialize:function(){var a,d,c,b;Mixin.instanceData(this,"Observable",{subscriptions:{},is_destroyed:false});b=[];for(d=0,c=arguments.length;d<c;d++){a=arguments[d];b.push(this.publishSubscription.apply(this,_.isArray(a)?a:[a]))}return b},destroy:function(){var a;a=Mixin.instanceData(this,"Observable");if(a.is_destroyed){throw new Error("Mixin.Observable.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscriptions,void 0,{callback:(function(b){return b.destroy()})})},mixin_object:{hasSubscription:function(a){var b;if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.hasSubscription","subscription_name")}b=Mixin.instanceData(this,"Observable");return b.subscriptions.hasOwnProperty(a)},publishSubscription:function(a,b){var c;c=Mixin.instanceData(this,"Observable");if(b===void 0){b=Mixin.Subscription.TYPE.MULTIPLE}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.publishSubscription","subscription_name");Mixin.Core._Validate.noKey(c.subscriptions,a,"Mixin.Observable.publishSubscription","subscription_name")}c.subscriptions[a]=new Mixin.Subscriptions._Subscription(this,b);return this},subscriptions:function(){var e,a,d,c,b;e=Mixin.instanceData(this,"Observable");d=[];b=e.subscriptions;for(a in b){c=b[a];d.push(a)}return d},subscribers:function(b){var g,a,e,c,d,f;e=[];g=Mixin.instanceData(this,"Observable");if(b===void 0){d=g.subscriptions;for(a in d){c=d[a];c.subscribers(e)}}else{if(!g.subscriptions.hasOwnProperty(b)){throw new Error("Mixin.Observable.subscribers: subscriber '"+(_classOf(this))+"' does not recognize '"+b+"'")}f=g.subscriptions;for(a in f){c=f[a];if(c.subscription_name===b){c.subscribers(e)}}}return _.uniq(e)},addSubscriber:function(h,d){var e,a,c,g,i,b,f;c=Mixin.instanceData(this,"Observable");i=function(k,m,j){var l;j||(j={});if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.addSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.addSubscriber","notification_callback");Mixin.Core._Validate.object(j,"Mixin.Observable.addSubscriber","options");if(j.destroy!==void 0){Mixin.Core._Validate.callback(j.destroy,"Mixin.Observable.addSubscriber","options.destroy")}}Mixin.Core._Validate.hasKey(c.subscriptions,k,"Mixin.Observable.addSubscriber","subscription_name");l=c.subscriptions[k];return l.addSubscriber(h,m,j)};e=Array.prototype.slice.call(arguments,1);Mixin.Core._Validate.instanceWithMixin(h,"Subscriber","Mixin.Observable.addSubscriber","subscriber");if(e.length>1){a=e[1];if(!((_.isString(a)&&this.hasSubscription(a))||(_.isArray(a)&&(a.length>=1)&&_.isString(a[0])&&this.hasSubscription(a[0])))){i.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(b=0,f=e.length;b<f;b++){g=e[b];if(_.isArray(g)){i.apply(this,g)}else{i.apply(g)}}return this},notifySubscribers:function(a){var c,b;c=Mixin.instanceData(this,"Observable");if(c.is_destroyed){return}if(Mixin.DEBUG){Mixin.Core._Validate.string(a,"Mixin.Observable.notifySubscribers","subscription_name");Mixin.Core._Validate.hasKey(c.subscriptions,a,"Mixin.Observable.notifySubscribers")}b=c.subscriptions[a];if(!b){return}b.notifySubscribers.apply(b,Array.prototype.slice.call(arguments,1));return this},removeSubscriber:function(j,c,a){var g,d,f,i,b,e,h;f=Mixin.instanceData(this,"Observable");b=function(k,m){var l;if(Mixin.DEBUG){Mixin.Core._Validate.string(k,"Mixin.Observable.removeSubscriber","subscription_name");Mixin.Core._Validate.callback(m,"Mixin.Observable.removeSubscriber","notification_callback")}Mixin.Core._Validate.hasKey(f.subscriptions,k,"Mixin.Observable.removeSubscriber","subscription_name");l=f.subscriptions[k];return l.removeSubscriber(j,m,k)};g=Array.prototype.slice.call(arguments,1);if(Mixin.DEBUG){Mixin.Core._Validate.instanceWithMixin(j,"Subscriber","Mixin.Observable.removeSubscriber","subscriber")}if(g.length>1){d=g[1];if(!((_.isString(d)&&this.hasSubscription(d))||(_.isArray(d)&&(d.length>=1)&&_.isString(d[0])&&this.hasSubscription(d[0])))){b.apply(this,Array.prototype.slice.call(arguments,1));return this}}for(e=0,h=g.length;e<h;e++){i=g[e];if(_.isArray(i)){b.apply(this,i)}else{b.apply(i)}}return this},removeSubscribers:function(b,e){var f,a,c,d;f=Mixin.instanceData(this,"Observable");if(Mixin.DEBUG){if(b!==void 0){Mixin.Core._Validate.string(b,"Mixin.Observable.removeSubscribers","subscription_name");Mixin.Core._Validate.hasKey(f.subscriptions,b,"Mixin.Observable.removeSubscribers")}if(e!==void 0){Mixin.Core._Validate.callback(e,"Mixin.Observable.removeSubscribers","test_fn")}}if(b){c=f.subscriptions[b];if(!c){return}c.removeSubscribers(e)}else{d=f.subscriptions;for(a in d){c=d[a];c.removeSubscribers(e)}}return this}}};Mixin.Subscriptions.Subscriber||(Mixin.Subscriptions.Subscriber={});Mixin.Subscriptions.Subscriber._mixin_info={mixin_name:"Subscriber",initialize:function(){return Mixin.instanceData(this,"Subscriber",{subscription_backlinks:[],is_destroyed:false})},destroy:function(){var a;a=Mixin.instanceData(this,"Subscriber");if(a.is_destroyed){throw new Error("Mixin.Subscriber.destroy: already destroyed")}a.is_destroyed=true;return _.remove(a.subscription_backlinks,void 0,{callback:(function(b){return b.destroy()}),preclear:true})},mixin_object:{observables:function(b){var h,d,j,f,e,i,a,g,c;h=Mixin.instanceData(this,"Subscriber");d=[];if(b===void 0){g=h.subscription_backlinks;for(f=0,i=g.length;f<i;f++){j=g[f];if(j.subscription&&(j.subscription.subscription_name===b)){d.push(j.subscription.observable)}}}else{if(Mixin.DEBUG){Mixin.Core._Validate.string(b,"Mixin.Subscriptions.observables","subscription_name")}c=h.subscription_backlinks;for(e=0,a=c.length;e<a;e++){j=c[e];if(j.subscription){d.push(j.subscription.observable)}}}return _.uniq(d)}}};Mixin.Subscriptions.ObservableSubscriber||(Mixin.Subscriptions.ObservableSubscriber={});Mixin.Subscriptions.ObservableSubscriber._mixin_info={mixin_name:"ObservableSubscriber",mixin_object:{},initialize:function(){return Mixin["in"](this,"Subscriber",["Observable"].concat(Array.prototype.slice.call(arguments)))},destroy:function(){return Mixin.out(this,"Subscriber","Observable")}};Mixin.registerMixin(Mixin.Subscriptions.Observable._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.Subscriber._mixin_info);Mixin.registerMixin(Mixin.Subscriptions.ObservableSubscriber._mixin_info);
8 src/mixin_subscriptions.coffee
View
@@ -95,7 +95,7 @@ Mixin.Subscriptions.Observable._mixin_info =
initialize: ->
Mixin.instanceData(this, 'Observable', {subscriptions: {}, is_destroyed: false})
- (@addSubscription.apply(this, if _.isArray(arg) then arg else [arg])) for arg in arguments
+ (@publishSubscription.apply(this, if _.isArray(arg) then arg else [arg])) for arg in arguments
destroy: ->
instance_data = Mixin.instanceData(this, 'Observable')
@@ -110,12 +110,12 @@ Mixin.Subscriptions.Observable._mixin_info =
instance_data = Mixin.instanceData(this, 'Observable')
return (instance_data.subscriptions.hasOwnProperty(subscription_name))
- addSubscription: (subscription_name, subscription_type) ->
+ publishSubscription: (subscription_name, subscription_type) ->
instance_data = Mixin.instanceData(this, 'Observable')
subscription_type = Mixin.Subscription.TYPE.MULTIPLE if (subscription_type == undefined)
if Mixin.DEBUG
- Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name')
- Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.addSubscription', 'subscription_name')
+ Mixin.Core._Validate.string(subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name')
+ Mixin.Core._Validate.noKey(instance_data.subscriptions, subscription_name, 'Mixin.Observable.publishSubscription', 'subscription_name')
instance_data.subscriptions[subscription_name] = new Mixin.Subscriptions._Subscription(this, subscription_type)
return this
44 test/mixin_subscriptions/build/test.js
View
@@ -162,35 +162,35 @@ $(document).ready(function() {
}), Error, "Mixin.Observable.hasSubscription: subscription_name invalid");
observable = new Observerable();
raises((function() {
- return observable.addSubscription();
- }), Error, "Mixin.Observable.addSubscription: subscription_name missing");
+ return observable.publishSubscription();
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name missing");
raises((function() {
- return observable.addSubscription(0);
- }), Error, "Mixin.Observable.addSubscription: subscription_name invalid");
+ return observable.publishSubscription(0);
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name invalid");
raises((function() {
- return observable.addSubscription({});
- }), Error, "Mixin.Observable.addSubscription: subscription_name invalid");
+ return observable.publishSubscription({});
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name invalid");
raises((function() {
- return observable.addSubscription([]);
- }), Error, "Mixin.Observable.addSubscription: subscription_name invalid");
+ return observable.publishSubscription([]);
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name invalid");
raises((function() {
- return observable.addSubscription(observable);
- }), Error, "Mixin.Observable.addSubscription: subscription_name invalid");
+ return observable.publishSubscription(observable);
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name invalid");
raises((function() {
- return observable.addSubscription(Observerable);
- }), Error, "Mixin.Observable.addSubscription: subscription_name invalid");
+ return observable.publishSubscription(Observerable);
+ }), Error, "Mixin.Observable.publishSubscription: subscription_name invalid");
raises((function() {
- return observable.addSubscription('Hello', 42);
- }), Error, "Mixin.Observable.addSubscription: options invalid");
+ return observable.publishSubscription('Hello', 42);
+ }), Error, "Mixin.Observable.publishSubscription: options invalid");
raises((function() {
- return observable.addSubscription('Hello', []);
- }), Error, "Mixin.Observable.addSubscription: options invalid");
+ return observable.publishSubscription('Hello', []);
+ }), Error, "Mixin.Observable.publishSubscription: options invalid");
raises((function() {
- return observable.addSubscription('Hello', observable);
- }), Error, "Mixin.Observable.addSubscription: options invalid");
+ return observable.publishSubscription('Hello', observable);
+ }), Error, "Mixin.Observable.publishSubscription: options invalid");
raises((function() {
- return observable.addSubscription('Hello', Observerable);
- }), Error, "Mixin.Observable.addSubscription: options invalid");
+ return observable.publishSubscription('Hello', Observerable);
+ }), Error, "Mixin.Observable.publishSubscription: options invalid");
observable = new Observerable();
raises((function() {
return observable.subscribers('Hello');
@@ -239,7 +239,7 @@ $(document).ready(function() {
raises((function() {
return observable.addSubscriber(subscriber, ['Hello']);
}), Error, "Mixin.Observable.subscribe: Hello does not exist for subscription_name");
- observable.addSubscription('Hello');
+ observable.publishSubscription('Hello');
raises((function() {
return observable.addSubscriber(subscriber, ['Hello', (function() {})], 'Goodbye');
}), Error, "Mixin.Observable.subscribe: Goodbye does not exist for subscription_name");
@@ -385,7 +385,7 @@ $(document).ready(function() {
raises((function() {
return observable.removeSubscribers(Observerable);
}), Error, "Mixin.Observable.removeSubscribers: subscription_name invalid");
- observable.addSubscription('Hello');
+ observable.publishSubscription('Hello');
observable.removeSubscribers('Hello');
raises((function() {
return observable.removeSubscribers('Hello', 0);
24 test/mixin_subscriptions/test.coffee
View
@@ -126,16 +126,16 @@ $(document).ready( ->
raises((->observable.hasSubscription(Observerable)), Error, "Mixin.Observable.hasSubscription: subscription_name invalid")
observable = new Observerable()
- raises((->observable.addSubscription()), Error, "Mixin.Observable.addSubscription: subscription_name missing")
- raises((->observable.addSubscription(0)), Error, "Mixin.Observable.addSubscription: subscription_name invalid")
- raises((->observable.addSubscription({})), Error, "Mixin.Observable.addSubscription: subscription_name invalid")
- raises((->observable.addSubscription([])), Error, "Mixin.Observable.addSubscription: subscription_name invalid")
- raises((->observable.addSubscription(observable)), Error, "Mixin.Observable.addSubscription: subscription_name invalid")
- raises((->observable.addSubscription(Observerable)), Error, "Mixin.Observable.addSubscription: subscription_name invalid")
- raises((->observable.addSubscription('Hello', 42)), Error, "Mixin.Observable.addSubscription: options invalid")
- raises((->observable.addSubscription('Hello', [])), Error, "Mixin.Observable.addSubscription: options invalid")
- raises((->observable.addSubscription('Hello', observable)), Error, "Mixin.Observable.addSubscription: options invalid")
- raises((->observable.addSubscription('Hello', Observerable)), Error, "Mixin.Observable.addSubscription: options invalid")
+ raises((->observable.publishSubscription()), Error, "Mixin.Observable.publishSubscription: subscription_name missing")
+ raises((->observable.publishSubscription(0)), Error, "Mixin.Observable.publishSubscription: subscription_name invalid")
+ raises((->observable.publishSubscription({})), Error, "Mixin.Observable.publishSubscription: subscription_name invalid")
+ raises((->observable.publishSubscription([])), Error, "Mixin.Observable.publishSubscription: subscription_name invalid")
+ raises((->observable.publishSubscription(observable)), Error, "Mixin.Observable.publishSubscription: subscription_name invalid")
+ raises((->observable.publishSubscription(Observerable)), Error, "Mixin.Observable.publishSubscription: subscription_name invalid")
+ raises((->observable.publishSubscription('Hello', 42)), Error, "Mixin.Observable.publishSubscription: options invalid")
+ raises((->observable.publishSubscription('Hello', [])), Error, "Mixin.Observable.publishSubscription: options invalid")
+ raises((->observable.publishSubscription('Hello', observable)), Error, "Mixin.Observable.publishSubscription: options invalid")
+ raises((->observable.publishSubscription('Hello', Observerable)), Error, "Mixin.Observable.publishSubscription: options invalid")
observable = new Observerable()
raises((->observable.subscribers('Hello')), Error, "Mixin.Observable.subscribers: subscriber 'Observerable' does not recognize 'Hello'")
@@ -156,7 +156,7 @@ $(document).ready( ->
subscriber = new Subscriber()
raises((->observable.addSubscriber(subscriber, 'Hello')), Error, "Mixin.Observable.subscribe: Hello does not exist for subscription_name")
raises((->observable.addSubscriber(subscriber, ['Hello'])), Error, "Mixin.Observable.subscribe: Hello does not exist for subscription_name")
- observable.addSubscription('Hello')
+ observable.publishSubscription('Hello')
raises((->observable.addSubscriber(subscriber, ['Hello', (->)], 'Goodbye')), Error, "Mixin.Observable.subscribe: Goodbye does not exist for subscription_name")
raises((->observable.addSubscriber(subscriber, ['Hello', (->)], ['Goodbye'])), Error, "Mixin.Observable.subscribe: Goodbye does not exist for subscription_name")
raises((->observable.addSubscriber(subscriber, ['Hello', (->)], ['Good day', 'sir!'])), Error, "Mixin.Observable.subscribe: Goodbye does not exist for subscription_name")
@@ -210,7 +210,7 @@ $(document).ready( ->
raises((->observable.removeSubscribers([])), Error, "Mixin.Observable.removeSubscribers: subscription_name invalid")
raises((->observable.removeSubscribers(observable)), Error, "Mixin.Observable.removeSubscribers: subscription_name invalid")
raises((->observable.removeSubscribers(Observerable)), Error, "Mixin.Observable.removeSubscribers: subscription_name invalid")
- observable.addSubscription('Hello'); observable.removeSubscribers('Hello')
+ observable.publishSubscription('Hello'); observable.removeSubscribers('Hello')
raises((->observable.removeSubscribers('Hello', 0)), Error, "Mixin.Observable.removeSubscribers: test_fn invalid")
raises((->observable.removeSubscribers('Hello', {})), Error, "Mixin.Observable.removeSubscribers: test_fn invalid")
raises((->observable.removeSubscribers('Hello', [])), Error, "Mixin.Observable.removeSubscribers: test_fn invalid")
Please sign in to comment.
Something went wrong with that request. Please try again.