Sha256: b99a73dd3e1be239d997b9469a09c2e09854895433d3988cd78bbf2528ec72e5

Contents?: true

Size: 846 Bytes

Versions: 33

Compression:

Stored size: 846 Bytes

Contents

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function once(emitter, name, { signal } = {}) {
    return new Promise((resolve, reject) => {
        function cleanup() {
            signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cleanup);
            emitter.removeListener(name, onEvent);
            emitter.removeListener('error', onError);
        }
        function onEvent(...args) {
            cleanup();
            resolve(args);
        }
        function onError(err) {
            cleanup();
            reject(err);
        }
        signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cleanup);
        emitter.on(name, onEvent);
        emitter.on('error', onError);
    });
}
exports.default = once;
//# sourceMappingURL=index.js.map

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.59 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.58 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.57 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.56 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.55 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.54 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.53 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.52 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.51 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.50 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.49 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.48 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.47 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.46 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.45 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.44 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.43 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.42 node_modules/@tootallnate/once/dist/index.js
immosquare-cleaner-0.1.41 node_modules/@tootallnate/once/dist/index.js