10 lines
941 B
JavaScript
10 lines
941 B
JavaScript
![]() |
/*!
|
||
|
* Amplify Core 1.1.0
|
||
|
*
|
||
|
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||
|
* Dual licensed under the MIT or GPL licenses.
|
||
|
* http://appendto.com/open-source-licenses
|
||
|
*
|
||
|
* http://amplifyjs.com
|
||
|
*/
|
||
|
(function(a,b){var c=[].slice,d={},e=a.amplify={publish:function(a){var b=c.call(arguments,1),e,f,g,h=0,i;if(!d[a])return!0;e=d[a].slice();for(g=e.length;h<g;h++){f=e[h],i=f.callback.apply(f.context,b);if(i===!1)break}return i!==!1},subscribe:function(a,b,c,e){arguments.length===3&&typeof c=="number"&&(e=c,c=b,b=null),arguments.length===2&&(c=b,b=null),e=e||10;var f=0,g=a.split(/\s/),h=g.length,i;for(;f<h;f++){a=g[f],i=!1,d[a]||(d[a]=[]);var j=d[a].length-1,k={callback:c,context:b,priority:e};for(;j>=0;j--)if(d[a][j].priority<=e){d[a].splice(j+1,0,k),i=!0;break}i||d[a].unshift(k)}return c},unsubscribe:function(a,b){if(!!d[a]){var c=d[a].length,e=0;for(;e<c;e++)if(d[a][e].callback===b){d[a].splice(e,1);break}}}}})(this)
|