-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventify-min.js
2 lines (2 loc) · 1.27 KB
/
eventify-min.js
1
2
(function(t){if(typeof define==="function"&&define.amd){define(function(){return t})}else if(typeof module!=="undefined"&&module.exports){module.exports=t}else{window.Eventify=t}})(function(){function t(){this.events={}}var e={on:function(t,e,n){var r=t.split(" "),i=r.length,o=void 0;if((typeof t!=="string"||typeof e!=="function")&&r[0].length>0)throw new TypeError("Invalid input arguments.");for(var f=0;f<i;f++){this.events[r[f]]={context:n||o,callback:e}}return this},off:function(t){if(this.isEvent(t))delete this.events[t];return this},trigger:function(t){var e=this.events[t],n=e.context||this,r=Array.prototype.slice.call(arguments);r.splice(0,1);if(this.isEvent(t))e.callback.apply(n,r);return this},isEvent:function(t){if(typeof t!=="string"||t.length<1)return false;if(!this.events[t])return false;return true}};var n=t.extend=function(){var t=arguments.length,e=arguments[0];if(t<2||e===void 0)return{};for(var n=1;n<t;n++){var i=arguments[n],o=r(i),f=o.length;for(var s=0;s<f;s++){var u=o[s];e[u]=i[u]}}return e};var r=t.getKeys=function(t){var e=[];if(!i(t))return e;for(var n in t){e.push(n)}return e};var i=t.isObject=function(t){return typeof t==="object"&&!!t};var o=t.mixin=function(e){n(t.prototype,e)};o(e);t.version="1.0.0";return t}());
//# sourceMappingURL=eventify-min.map