diff --git a/.npmignore b/.npmignore index e8349bd..d1c78fa 100644 --- a/.npmignore +++ b/.npmignore @@ -1,12 +1,16 @@ -build-browser-diags.json -build-browser.json -build-all.sh -nodetesthost.js example -node_modules +node_modules* spec src ext -lib/browser +lib/standard lib/amd -diags \ No newline at end of file +diags +.gitignore +.idea +build.json +header.js +.anvil +component.json +.npmignore +classic-resolver* \ No newline at end of file diff --git a/build.json b/build.json index f6d4185..a22e539 100644 --- a/build.json +++ b/build.json @@ -12,8 +12,7 @@ "full": "lib", "partial": { "/standard/postal.*": "./example/standard/js", - "/amd/postal.*": "./example/amd/js/libs/postal", - "/amd/postal.*": "./example/node/client/js/lib", + "/amd/postal.*": [ "./example/amd/js/libs/postal", "./example/node/client/js/lib" ], "/node/postal.js": "./example/node/messaging" } }, diff --git a/example/amd/js/libs/postal/postal.js b/example/amd/js/libs/postal/postal.js index bb450d1..16f98a8 100644 --- a/example/amd/js/libs/postal/postal.js +++ b/example/amd/js/libs/postal/postal.js @@ -1,10 +1,9 @@ -/* - postal.js - Author: Jim Cowart - License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) - Version 0.7.1 - */ - +/* + postal + Author: Jim Cowart (http://freshbrewedcode.com/jimcowart) + License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) + Version 0.7.1 + */ // This is the amd-module version of postal.js // If you need the standard lib style version, go to http://github.com/ifandelse/postal.js define( ["underscore"], function ( _, undefined ) { diff --git a/example/amd/js/libs/postal/postal.min.js b/example/amd/js/libs/postal/postal.min.js index 431909f..99a52ca 100644 --- a/example/amd/js/libs/postal/postal.min.js +++ b/example/amd/js/libs/postal/postal.min.js @@ -1 +1,7 @@ +/* + postal + Author: Jim Cowart (http://freshbrewedcode.com/jimcowart) + License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) + Version 0.7.1 + */ define(["underscore"],function(e,t){var n="/",r=50,i=0,s="postal",o=function(){},u=function(){var t=[];return function(n){var r=!e.any(t,function(t){return e.isObject(n)||e.isArray(n)?e.isEqual(n,t):n===t});return r&&t.push(n),r}},a=function(){var t;return function(n){var r=!1;return e.isString(n)?(r=n===t,t=n):(r=e.isEqual(n,t),t=e.clone(n)),!r}},f=function(e,t){this.channel=e||n,this._topic=t||""};f.prototype={subscribe:function(){var e=arguments.length;if(e===1)return new l(this.channel,this._topic,arguments[0]);if(e===2)return new l(this.channel,arguments[0],arguments[1])},publish:function(e){var t=e||{},n={channel:this.channel,topic:this._topic,data:t};return t.topic&&t.data&&(n=t,n.channel=n.channel||this.channel),n.timeStamp=new Date,m.configuration.bus.publish(n),n},topic:function(e){return e===this._topic?this:new f(this.channel,e)}};var l=function(e,t,n){this.channel=e,this.topic=t,this.callback=n,this.priority=r,this.constraints=new Array(0),this.maxCalls=i,this.onHandled=o,this.context=null,m.configuration.bus.publish({channel:s,topic:"subscription.created",timeStamp:new Date,data:{event:"subscription.created",channel:e,topic:t}}),m.configuration.bus.subscribe(this)};l.prototype={unsubscribe:function(){m.configuration.bus.unsubscribe(this),m.configuration.bus.publish({channel:s,topic:"subscription.removed",timeStamp:new Date,data:{event:"subscription.removed",channel:this.channel,topic:this.topic}})},defer:function(){var e=this.callback;return this.callback=function(t){setTimeout(e,0,t)},this},disposeAfter:function(t){if(e.isNaN(t)||t<=0)throw"The value provided to disposeAfter (maxCalls) must be a number greater than zero.";var n=this.onHandled,r=e.after(t,e.bind(function(){this.unsubscribe(this)},this));return this.onHandled=function(){n.apply(this.context,arguments),r()},this},distinctUntilChanged:function(){return this.withConstraint(new a),this},distinct:function(){return this.withConstraint(new u),this},withConstraint:function(t){if(!e.isFunction(t))throw"Predicate constraint must be a function";return this.constraints.push(t),this},withConstraints:function(t){var n=this;return e.isArray(t)&&e.each(t,function(e){n.withConstraint(e)}),n},withContext:function(e){return this.context=e,this},withDebounce:function(t){if(e.isNaN(t))throw"Milliseconds must be a number";var n=this.callback;return this.callback=e.debounce(n,t),this},withDelay:function(t){if(e.isNaN(t))throw"Milliseconds must be a number";var n=this.callback;return this.callback=function(e){setTimeout(function(){n(e)},t)},this},withPriority:function(t){if(e.isNaN(t))throw"Priority must be a number";return this.priority=t,m.configuration.bus.changePriority(this),this},withThrottle:function(t){if(e.isNaN(t))throw"Milliseconds must be a number";var n=this.callback;return this.callback=e.throttle(n,t),this},subscribe:function(e){return this.callback=e,this}};var c={cache:{},compare:function(e,t){if(this.cache[t]&&this.cache[t][e])return!0;var n=("^"+e.replace(/\./g,"\\.").replace(/\*/g,"[A-Z,a-z,0-9]*").replace(/#/g,".*")+"$").replace("\\..*$","(\\..*)*$").replace("^.*\\.","^(.*\\.)*"),r=new RegExp(n),i=r.test(t);return i&&(this.cache[t]||(this.cache[t]={}),this.cache[t][e]=!0),i},reset:function(){this.cache={}}},h={addWireTap:function(e){var t=this;return t.wireTaps.push(e),function(){var n=t.wireTaps.indexOf(e);n!==-1&&t.wireTaps.splice(n,1)}},changePriority:function(t){var n,r;if(this.subscriptions[t.channel]&&this.subscriptions[t.channel][t.topic]){this.subscriptions[t.channel][t.topic]=e.without(this.subscriptions[t.channel][t.topic],t),n=this.subscriptions[t.channel][t.topic].length-1;for(;n>=0;n--)if(this.subscriptions[t.channel][t.topic][n].priority<=t.priority){this.subscriptions[t.channel][t.topic].splice(n+1,0,t),r=!0;break}r||this.subscriptions[t.channel][t.topic].unshift(t)}},publish:function(t){e.each(this.wireTaps,function(e){e(t.data,t)}),e.each(this.subscriptions[t.channel],function(n){e.each(e.clone(n),function(n){m.configuration.resolver.compare(n.topic,t.topic)&&e.all(n.constraints,function(e){return e(t.data,t)})&&typeof n.callback=="function"&&(n.callback.apply(n.context,[t.data,t]),n.onHandled())})})},reset:function(){this.subscriptions&&(e.each(this.subscriptions,function(t){e.each(t,function(e){while(e.length)e.pop().unsubscribe()})}),this.subscriptions={})},subscribe:function(e){var t,n,r,i=this.subscriptions[e.channel],s;return i||(i=this.subscriptions[e.channel]={}),s=this.subscriptions[e.channel][e.topic],s||(s=this.subscriptions[e.channel][e.topic]=new Array(0)),s.push(e),e},subscriptions:{},wireTaps:new Array(0),unsubscribe:function(e){if(this.subscriptions[e.channel][e.topic]){var t=this.subscriptions[e.channel][e.topic].length,n=0;for(;n=0.4.0"