cryptalk/public/js/vendor/castrato/castrato.js

3 lines
1022 B
JavaScript
Raw Normal View History

2014-09-26 08:46:35 -04:00
// Licenced under MIT - castrato - ©2014 Pehr Boman <github.com/unkelpehr>
2014-09-27 08:19:56 -04:00
(function(f,g){"function"===typeof define&&define.amd?define([],g()):"object"===typeof exports?module.exports=g:f.castrato=g})(this,function(){function f(e,a,b,c){var d=[e,b,1<b.length];(h[a]||(h[a]=[])).push(d);if(m[a])for(e=0,d=[d];(b=m[a][e++])&&(k(0,0,b[0],b[1],d),!c););}function g(e,a,b){var c=0;if(toSubs=h[a])for(;a=toSubs[c++];)a[0]!==e||b&&b!==a[1]||toSubs.splice(--c,1)}function k(e,a,b,c,d){var l=d||h[a]||[],g=l.length,f,k,n=[],p;h["*"]&&(l=l.concat(h["*"]));if(k=f=l.length)for(p=c?function(a){a&&
n.push(a);--f||(c(n,g),c=0)}:q;d=l[--k];)d[1](b,d[2]?p:f--,a);!f&&c&&c(n,g);e&&(m[a]||(m[a]=[])).push([b,c])}var r=0,h={},m={},q=function(){};return function(){var e=r++;return{emit:function(a,b,c,d){!0!==a&&!1!==a&&(d=c,c=b,b=a,a=!1);k(a,b,c,d);return this},on:function(a,b){f(e,a,b);return this},once:function(a,b){f(e,a,function d(f,h){g(e,a,d);b(f,1<b.length?h:h())},!0);return this},off:function(a,b){g(e,a,b);return this}}}}());