text: // knockout-postbox 0.5.1 | (c) 2015 Ryan Niemeyer |  http://www.opensource.org/licenses/mit-license
  !function(a){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?a(require("knockout"),exports):"function"==typeof define&&define.amd?define(["knockout","exports"],a):a(ko,ko.postbox={})}(function(a,b,c){var d,e,f={},g=1;b.subscriptions=f,a.subscribable.call(b),b.topicCache={},b.serializer=a.toJSON,b.publish=function(a,c){a&&(b.topicCache[a]={value:c,serialized:b.serializer(c)},b.notifySubscribers(c,a))},e=b.subscribe,b.subscribe=function(a,d,h,i){var j,k,l;return a?("boolean"==typeof h&&(i=h,h=c),j=e.call(b,d,h,a),j.subId=++g,f[g]=j,i&&(k=b.topicCache[a],k!==c&&d.call(h,k.value)),l=j.dispose,j.dispose=function(){delete f[j.subId],l.call(j)},j):void 0},b.reset=function(){var a;for(var c in f)f.hasOwnProperty(c)&&(a=f[c],a&&"function"==typeof a.dispose&&a.dispose());b.topicCache={}},b.defaultComparer=function(a,c){return c&&b.serializer(a)===c.serialized},a.subscribable.fn.publishOn=function(a,c,e){var h,i,j;return a&&("function"==typeof c?e=c:h=c,e=e||b.defaultComparer,d.call(this,a,"publishOn"),i=this.subscribe(function(c){e.call(this,c,b.topicCache[a])||b.publish(a,c)},this),i.id=++g,f[g]=i,j=i.dispose,i.dispose=function(){delete this.postboxSubs[a].publishOn,delete f[i.id],j.call(i)}.bind(this),this.postboxSubs[a].publishOn=i,h||b.publish(a,this())),this},d=function(a,b){var c=this.postboxSubs=this.postboxSubs||{};c[a]=c[a]||{},c[a][b]&&c[a][b].dispose()},a.subscribable.fn.stopPublishingOn=function(a){return d.call(this,a,"publishOn"),this},a.subscribable.fn.subscribeTo=function(e,f,g){var h,i,j,k,l,m=this;return"function"==typeof f?g=f:h=f,e&&a.isWriteableObservable(this)&&(d.call(this,e,"subscribeTo"),j=function(a){m(g?g.call(m,a):a)},k=b.subscribe(e,j),this.postboxSubs[e].subscribeTo=k,l=k.dispose,k.dispose=function(){delete this.postboxSubs[e].subscribeTo,l.call(k)}.bind(this),h&&(i=b.topicCache[e],i!==c&&j(i.value))),this},a.subscribable.fn.unsubscribeFrom=function(a){return d.call(this,a,"subscribeTo"),this},a.subscribable.fn.syncWith=function(a,b,c,d){return this.subscribeTo(a,b).publishOn(a,c,d),this},a.postbox=b});