Fix:Include Watcher as lib with no dependencies and fix tiny-readdir bug #610

This commit is contained in:
advplyr 2022-05-28 20:01:20 -05:00
parent 160dac109d
commit ec6e70725c
34 changed files with 2187 additions and 281 deletions

View file

@ -0,0 +1,39 @@
"use strict";
/* IMPORT */
Object.defineProperty(exports, "__esModule", { value: true });
/* ABORT SIGNAL */
var AbortSignal = /** @class */ (function () {
function AbortSignal() {
/* VARIABLES */
this.aborted = false;
this.listeners = {};
}
/* EVENTS API */
AbortSignal.prototype.addEventListener = function (event, listener) {
var listeners = this.listeners[event] || (this.listeners[event] = []);
listeners.push(listener);
};
AbortSignal.prototype.removeEventListener = function (event, listener) {
var listeners = this.listeners[event];
if (!listeners)
return;
listeners.splice(listeners.indexOf(listener), 1);
};
AbortSignal.prototype.dispatchEvent = function (event) {
var listeners = this.listeners[event];
if (!listeners)
return true;
listeners.slice().forEach(function (listener) { return listener(); });
return true;
};
/* API */
AbortSignal.prototype.abort = function () {
if (this.aborted)
return;
this.aborted = true;
this.dispatchEvent('abort');
};
return AbortSignal;
}());
/* EXPORT */
exports.default = AbortSignal;