@azure/abort-controller
Advanced tools
Comparing version 1.0.0-preview.1 to 1.0.0-preview.2
@@ -55,2 +55,8 @@ (function (global, factory) { | ||
function AbortSignal() { | ||
/** | ||
* onabort event listener. | ||
* | ||
* @memberof AbortSignal | ||
*/ | ||
this.onabort = null; | ||
listenersMap.set(this, []); | ||
@@ -126,2 +132,8 @@ abortedMap.set(this, false); | ||
}; | ||
/** | ||
* Dispatches a synthetic event to the AbortSignal. | ||
*/ | ||
AbortSignal.prototype.dispatchEvent = function (event) { | ||
throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes."); | ||
}; | ||
return AbortSignal; | ||
@@ -147,5 +159,7 @@ }()); | ||
var listeners = listenersMap.get(signal); | ||
listeners.forEach(function (listener) { | ||
listener.call(signal); | ||
}); | ||
if (listeners) { | ||
listeners.forEach(function (listener) { | ||
listener.call(signal, { type: "abort" }); | ||
}); | ||
} | ||
abortedMap.set(signal, true); | ||
@@ -280,4 +294,2 @@ } | ||
/// <reference lib="es5" /> | ||
exports.AbortController = AbortController; | ||
@@ -284,0 +296,0 @@ exports.AbortError = AbortError; |
@@ -20,2 +20,8 @@ var listenersMap = new WeakMap(); | ||
function AbortSignal() { | ||
/** | ||
* onabort event listener. | ||
* | ||
* @memberof AbortSignal | ||
*/ | ||
this.onabort = null; | ||
listenersMap.set(this, []); | ||
@@ -91,2 +97,8 @@ abortedMap.set(this, false); | ||
}; | ||
/** | ||
* Dispatches a synthetic event to the AbortSignal. | ||
*/ | ||
AbortSignal.prototype.dispatchEvent = function (event) { | ||
throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes."); | ||
}; | ||
return AbortSignal; | ||
@@ -113,7 +125,9 @@ }()); | ||
var listeners = listenersMap.get(signal); | ||
listeners.forEach(function (listener) { | ||
listener.call(signal); | ||
}); | ||
if (listeners) { | ||
listeners.forEach(function (listener) { | ||
listener.call(signal, { type: "abort" }); | ||
}); | ||
} | ||
abortedMap.set(signal, true); | ||
} | ||
//# sourceMappingURL=AbortSignal.js.map |
@@ -26,2 +26,8 @@ 'use strict'; | ||
function AbortSignal() { | ||
/** | ||
* onabort event listener. | ||
* | ||
* @memberof AbortSignal | ||
*/ | ||
this.onabort = null; | ||
listenersMap.set(this, []); | ||
@@ -97,2 +103,8 @@ abortedMap.set(this, false); | ||
}; | ||
/** | ||
* Dispatches a synthetic event to the AbortSignal. | ||
*/ | ||
AbortSignal.prototype.dispatchEvent = function (event) { | ||
throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes."); | ||
}; | ||
return AbortSignal; | ||
@@ -118,5 +130,7 @@ }()); | ||
var listeners = listenersMap.get(signal); | ||
listeners.forEach(function (listener) { | ||
listener.call(signal); | ||
}); | ||
if (listeners) { | ||
listeners.forEach(function (listener) { | ||
listener.call(signal, { type: "abort" }); | ||
}); | ||
} | ||
abortedMap.set(signal, true); | ||
@@ -251,4 +265,2 @@ } | ||
/// <reference lib="es5" /> | ||
exports.AbortController = AbortController; | ||
@@ -255,0 +267,0 @@ exports.AbortError = AbortError; |
{ | ||
"name": "@azure/abort-controller", | ||
"sdk-type": "client", | ||
"version": "1.0.0-preview.1", | ||
"version": "1.0.0-preview.2", | ||
"description": "Microsoft Azure SDK for JavaScript - Aborter", | ||
@@ -24,4 +24,4 @@ "main": "./dist/index.js", | ||
"integration-test": "npm run integration-test:node && npm run integration-test:browser", | ||
"lint:fix": "echo skipped", | ||
"lint": "echo skipped", | ||
"lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" -c ../../.eslintrc.json --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint -c ../../.eslintrc.json src test --ext .ts -f html -o abort-controller-lintReport.html || exit 0", | ||
"pack": "npm pack 2>&1", | ||
@@ -34,3 +34,3 @@ "prebuild": "npm run clean", | ||
"unit-test:browser": "karma start --single-run", | ||
"unit-test:node": "cross-env TS_NODE_FILES=true TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\": \\\"commonjs\\\"}\" mocha --require ts-node/register --require source-map-support/register --reporter mocha-multi-reporters --reporter-options configFile=mocha.reporter.config.json --full-trace --no-timeouts test/*.spec.ts", | ||
"unit-test:node": "cross-env TS_NODE_FILES=true TS_NODE_COMPILER_OPTIONS=\"{\\\"module\\\": \\\"commonjs\\\"}\" mocha --require ts-node/register --require source-map-support/register --reporter mocha-multi --reporter-options spec=-,mocha-junit-reporter=- --full-trace --no-timeouts test/*.spec.ts", | ||
"unit-test": "npm run unit-test:node && npm run unit-test:browser" | ||
@@ -40,3 +40,3 @@ }, | ||
"engine": { | ||
"node": ">=6.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
@@ -70,3 +70,3 @@ "files": [ | ||
}, | ||
"homepage": "https://github.com/Azure/azure-sdk-for-js#readme", | ||
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/abort-controller", | ||
"sideEffects": false, | ||
@@ -80,8 +80,15 @@ "dependencies": { | ||
"@types/node": "^8.0.0", | ||
"@typescript-eslint/eslint-plugin": "^2.0.0", | ||
"@typescript-eslint/parser": "^2.0.0", | ||
"assert": "^1.4.1", | ||
"cross-env": "^5.2.0", | ||
"delay": "^4.2.0", | ||
"eslint": "^6.1.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
"eslint-plugin-no-only-tests": "^2.3.0", | ||
"eslint-plugin-promise": "^4.1.1", | ||
"karma": "^4.0.1", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage": "^1.1.2", | ||
"karma-chrome-launcher": "^3.0.0", | ||
"karma-coverage": "^2.0.0", | ||
"karma-edge-launcher": "^0.4.2", | ||
@@ -95,9 +102,9 @@ "karma-env-preprocessor": "^0.1.1", | ||
"karma-remap-coverage": "^0.1.5", | ||
"mocha": "^5.2.0", | ||
"mocha": "^6.2.0", | ||
"mocha-junit-reporter": "^1.18.0", | ||
"mocha-multi-reporters": "^1.1.7", | ||
"mocha-multi": "^1.1.3", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.16.4", | ||
"rimraf": "^2.6.2", | ||
"rollup": "~1.13.1", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.16.3", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
@@ -108,5 +115,6 @@ "rollup-plugin-multi-entry": "^2.1.0", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-uglify": "^6.0.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.2.2" | ||
} | ||
} |
@@ -26,3 +26,3 @@ # Azure Abort Controller library for JS | ||
Calling `abort()` on the instantiated `AbortController` invokes the regiestered `abort` | ||
Calling `abort()` on the instantiated `AbortController` invokes the registered `abort` | ||
event listeners on the associated `AbortSignal`. | ||
@@ -103,4 +103,6 @@ Any subsequent calls to `abort()` on the same controller will have no effect. | ||
If you'd like to contribute to this library, please read the [contributing guide](../../../CONTRIBUTING.md) to learn more about how to build and test the code. | ||
This project has adopted the Microsoft Open Source Code of Conduct. | ||
For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional | ||
questions or comments. |
@@ -87,3 +87,3 @@ /// <reference path="./shims-public.d.ts" /> | ||
*/ | ||
public onabort?: (ev?: Event) => any; | ||
public onabort: ((ev?: Event) => any) | null = null; | ||
@@ -133,2 +133,9 @@ /** | ||
} | ||
/** | ||
* Dispatches a synthetic event to the AbortSignal. | ||
*/ | ||
dispatchEvent(event: Event): boolean { | ||
throw new Error("This is a stub dispatchEvent implementation that should not be used. It only exists for type-checking purposes.") | ||
} | ||
} | ||
@@ -156,7 +163,9 @@ | ||
const listeners = listenersMap.get(signal)!; | ||
listeners.forEach((listener) => { | ||
listener.call(signal); | ||
}); | ||
if (listeners) { | ||
listeners.forEach((listener) => { | ||
listener.call(signal, { type: "abort" }); | ||
}); | ||
} | ||
abortedMap.set(signal, true); | ||
} |
@@ -59,3 +59,3 @@ /// <reference path="../../src/shims-public.d.ts" /> | ||
*/ | ||
onabort?: (ev?: Event) => any; | ||
onabort: ((ev?: Event) => any) | null; | ||
/** | ||
@@ -77,3 +77,7 @@ * Added new "abort" event listener, only support "abort" event. | ||
removeEventListener(_type: "abort", listener: (this: AbortSignalLike, ev: any) => any): void; | ||
/** | ||
* Dispatches a synthetic event to the AbortSignal. | ||
*/ | ||
dispatchEvent(event: Event): boolean; | ||
} | ||
//# sourceMappingURL=AbortSignal.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95181
25
1309
107
39