awesome-only-resolves-last-promise
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,3 +0,1 @@ | ||
declare type AsyncFunction<I extends Array<any>, O> = (...inputs: I) => Promise<O>; | ||
export declare function onlyResolvesLast<I extends any[], O>(asyncFunction: AsyncFunction<I, O>): AsyncFunction<I, O>; | ||
export {}; | ||
export declare function onlyResolvesLast<T extends (...args: any[]) => any>(asyncFunction: T): T; |
@@ -28,5 +28,6 @@ function createImperativePromise(promiseArg) { | ||
// see https://stackoverflow.com/a/54825370/82609 | ||
function onlyResolvesLast(asyncFunction) { | ||
var cancelPrevious = null; | ||
return function wrappedAsyncFunction() { | ||
var wrappedFunction = function () { | ||
var args = []; | ||
@@ -42,2 +43,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
}; | ||
return wrappedFunction; // TODO fix TS | ||
} | ||
@@ -44,0 +46,0 @@ |
@@ -32,5 +32,6 @@ 'use strict'; | ||
// see https://stackoverflow.com/a/54825370/82609 | ||
function onlyResolvesLast(asyncFunction) { | ||
var cancelPrevious = null; | ||
return function wrappedAsyncFunction() { | ||
var wrappedFunction = function () { | ||
var args = []; | ||
@@ -46,2 +47,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
}; | ||
return wrappedFunction; // TODO fix TS | ||
} | ||
@@ -48,0 +50,0 @@ |
{ | ||
"name": "awesome-only-resolves-last-promise", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Wraps an async function and ensure only last call will actually resolve/reject", | ||
@@ -5,0 +5,0 @@ "author": "slorber", |
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
11738
92