UNPKG

typescript-dotnet-events

Version:

Basic events/dispatching library. Part of the TypeScript.NET-Core libraries.

8 lines (7 loc) 905 B
"use strict"; /*! * @author electricessence / https://github.com/electricessence/ * Based on Netjs mscorlib.ts * Licensing: MIT https://github.com/electricessence/TypeScript.NET-Core/blob/master/LICENSE.md */Object.defineProperty(exports,"__esModule",{value:!0});var EventSimple=function(){function t(){this._listeners=[]}return t.prototype.add=function(t){this._listeners.push(t)},t.prototype.remove=function(t){var e=this._listeners.indexOf(t);e<0||this._listeners.splice(e,1)},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0,i=this._listeners;n<i.length;n++){i[n].call(t)}},t.prototype.toMulticastFunction=function(){var n=this._listeners;return function(){for(var t=0,e=n;t<e.length;t++){e[t].call(arguments)}}},t.prototype.dispose=function(){this._listeners.length=0},t}();exports.default=EventSimple; //# sourceMappingURL=EventSimple.js.map