summaryrefslogtreecommitdiff
path: root/school/node_modules/@tootallnate/once
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
committerMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
commit99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch)
treee663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /school/node_modules/@tootallnate/once
parent9871b03912fc28ad38b4037ebf26a78aa937baba (diff)
downloadpluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip
Update - This is an automated commit
Diffstat (limited to 'school/node_modules/@tootallnate/once')
-rw-r--r--school/node_modules/@tootallnate/once/dist/index.d.ts14
-rw-r--r--school/node_modules/@tootallnate/once/dist/index.js39
-rw-r--r--school/node_modules/@tootallnate/once/dist/index.js.map1
-rw-r--r--school/node_modules/@tootallnate/once/package.json45
4 files changed, 99 insertions, 0 deletions
diff --git a/school/node_modules/@tootallnate/once/dist/index.d.ts b/school/node_modules/@tootallnate/once/dist/index.d.ts
new file mode 100644
index 0000000..a7efe94
--- /dev/null
+++ b/school/node_modules/@tootallnate/once/dist/index.d.ts
@@ -0,0 +1,14 @@
+/// <reference types="node" />
+import { EventEmitter } from 'events';
+declare function once<T>(emitter: EventEmitter, name: string): once.CancelablePromise<T>;
+declare namespace once {
+ interface CancelFunction {
+ (): void;
+ }
+ interface CancelablePromise<T> extends Promise<T> {
+ cancel: CancelFunction;
+ }
+ type CancellablePromise<T> = CancelablePromise<T>;
+ function spread<T extends any[]>(emitter: EventEmitter, name: string): once.CancelablePromise<T>;
+}
+export = once;
diff --git a/school/node_modules/@tootallnate/once/dist/index.js b/school/node_modules/@tootallnate/once/dist/index.js
new file mode 100644
index 0000000..bfd0dc8
--- /dev/null
+++ b/school/node_modules/@tootallnate/once/dist/index.js
@@ -0,0 +1,39 @@
+"use strict";
+function noop() { }
+function once(emitter, name) {
+ const o = once.spread(emitter, name);
+ const r = o.then((args) => args[0]);
+ r.cancel = o.cancel;
+ return r;
+}
+(function (once) {
+ function spread(emitter, name) {
+ let c = null;
+ const p = new Promise((resolve, reject) => {
+ function cancel() {
+ emitter.removeListener(name, onEvent);
+ emitter.removeListener('error', onError);
+ p.cancel = noop;
+ }
+ function onEvent(...args) {
+ cancel();
+ resolve(args);
+ }
+ function onError(err) {
+ cancel();
+ reject(err);
+ }
+ c = cancel;
+ emitter.on(name, onEvent);
+ emitter.on('error', onError);
+ });
+ if (!c) {
+ throw new TypeError('Could not get `cancel()` function');
+ }
+ p.cancel = c;
+ return p;
+ }
+ once.spread = spread;
+})(once || (once = {}));
+module.exports = once;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/school/node_modules/@tootallnate/once/dist/index.js.map b/school/node_modules/@tootallnate/once/dist/index.js.map
new file mode 100644
index 0000000..30d2049
--- /dev/null
+++ b/school/node_modules/@tootallnate/once/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,SAAS,IAAI,KAAI,CAAC;AAElB,SAAS,IAAI,CACZ,OAAqB,EACrB,IAAY;IAEZ,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAM,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAA8B,CAAC;IACtE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACpB,OAAO,CAAC,CAAC;AACV,CAAC;AAED,WAAU,IAAI;IAWb,SAAgB,MAAM,CACrB,OAAqB,EACrB,IAAY;QAEZ,IAAI,CAAC,GAA+B,IAAI,CAAC;QACzC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5C,SAAS,MAAM;gBACd,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACtC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBACzC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;YACjB,CAAC;YACD,SAAS,OAAO,CAAC,GAAG,IAAW;gBAC9B,MAAM,EAAE,CAAC;gBACT,OAAO,CAAC,IAAS,CAAC,CAAC;YACpB,CAAC;YACD,SAAS,OAAO,CAAC,GAAU;gBAC1B,MAAM,EAAE,CAAC;gBACT,MAAM,CAAC,GAAG,CAAC,CAAC;YACb,CAAC;YACD,CAAC,GAAG,MAAM,CAAC;YACX,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC1B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,CAAC,CAA8B,CAAC;QAChC,IAAI,CAAC,CAAC,EAAE;YACP,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;SACzD;QACD,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACb,OAAO,CAAC,CAAC;IACV,CAAC;IA5Be,WAAM,SA4BrB,CAAA;AACF,CAAC,EAxCS,IAAI,KAAJ,IAAI,QAwCb;AAED,iBAAS,IAAI,CAAC"} \ No newline at end of file
diff --git a/school/node_modules/@tootallnate/once/package.json b/school/node_modules/@tootallnate/once/package.json
new file mode 100644
index 0000000..8343f9f
--- /dev/null
+++ b/school/node_modules/@tootallnate/once/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "@tootallnate/once",
+ "version": "1.1.2",
+ "description": "Creates a Promise that waits for a single event",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "prebuild": "rimraf dist",
+ "build": "tsc",
+ "test": "mocha --reporter spec",
+ "test-lint": "eslint src --ext .js,.ts",
+ "prepublishOnly": "npm run build"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/TooTallNate/once.git"
+ },
+ "keywords": [],
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/TooTallNate/once/issues"
+ },
+ "devDependencies": {
+ "@types/node": "^12.12.11",
+ "@typescript-eslint/eslint-plugin": "1.6.0",
+ "@typescript-eslint/parser": "1.1.0",
+ "eslint": "5.16.0",
+ "eslint-config-airbnb": "17.1.0",
+ "eslint-config-prettier": "4.1.0",
+ "eslint-import-resolver-typescript": "1.1.1",
+ "eslint-plugin-import": "2.16.0",
+ "eslint-plugin-jsx-a11y": "6.2.1",
+ "eslint-plugin-react": "7.12.4",
+ "mocha": "^6.2.2",
+ "rimraf": "^3.0.0",
+ "typescript": "^3.7.3"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+}