Comparing version
@@ -1,3 +0,3 @@ | ||
export { }; | ||
declare global { | ||
export {}; | ||
declare global { | ||
interface AsyncIterable<T> { | ||
@@ -4,0 +4,0 @@ } |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -57,6 +57,6 @@ /*! ***************************************************************************** | ||
signalAndWait(token?: CancellationToken): Promise<void>; | ||
private _finishPhase(); | ||
private _nextPhase(); | ||
private _resolveNextPhase(); | ||
private _rejectNextPhase(error); | ||
private _finishPhase; | ||
private _nextPhase; | ||
private _resolveNextPhase; | ||
private _rejectNextPhase; | ||
} |
@@ -41,3 +41,3 @@ import "./asyncIterable"; | ||
drain(): AsyncIterableIterator<T>; | ||
private _dequeue(); | ||
private _dequeue; | ||
} |
@@ -17,3 +17,3 @@ "use strict"; | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
@@ -94,3 +94,3 @@ function reject(value) { resume("throw", value); } | ||
while (value !== BOUNDARY) { | ||
yield value; | ||
yield yield __await(value); | ||
value = yield __await(this._dequeue()); | ||
@@ -97,0 +97,0 @@ } |
@@ -39,7 +39,7 @@ /*! ***************************************************************************** | ||
*/ | ||
private _executeCallback(callback); | ||
private _executeCallback; | ||
/** | ||
* Unlinks the source from any linked tokens. | ||
*/ | ||
private _unlink(); | ||
private _unlink; | ||
} | ||
@@ -151,3 +151,3 @@ /** | ||
add(token: CancellationToken): this; | ||
private _checkSignalState(); | ||
private _checkSignalState; | ||
} |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -14,2 +14,3 @@ /*! ***************************************************************************** | ||
private _reject; | ||
private _callback?; | ||
/** | ||
@@ -24,13 +25,17 @@ * Initializes a new instance of the Deferred class. | ||
/** | ||
* Resolves the promise. | ||
* | ||
* @param value The value used to resolve the promise. | ||
* Gets the callback used to resolve the promise. | ||
*/ | ||
resolve(value?: PromiseLike<T> | T): void; | ||
readonly resolve: (value?: T | PromiseLike<T> | undefined) => void; | ||
/** | ||
* Rejects the promise. | ||
* | ||
* @param reason The reason the promise was rejected. | ||
* Gets the callback used to reject the promise. | ||
*/ | ||
reject(reason: any): void; | ||
readonly reject: (reason: any) => void; | ||
/** | ||
* Gets a NodeJS-style callback that can be used to resolve or reject the promise. | ||
*/ | ||
readonly callback: T extends void ? (err: Error | null | undefined) => void : (err: Error | null | undefined, value: T) => void; | ||
/** | ||
* Creates a NodeJS-style callback that can be used to resolve or reject the promise with multiple values. | ||
*/ | ||
createCallback<A extends any[]>(selector: (...args: A) => T): (err: Error | null | undefined, ...args: A) => void; | ||
} |
@@ -29,20 +29,35 @@ "use strict"; | ||
/** | ||
* Resolves the promise. | ||
* | ||
* @param value The value used to resolve the promise. | ||
* Gets the callback used to resolve the promise. | ||
*/ | ||
resolve(value) { | ||
this._resolve(value); | ||
get resolve() { return this._resolve; } | ||
/** | ||
* Gets the callback used to reject the promise. | ||
*/ | ||
get reject() { return this._reject; } | ||
/** | ||
* Gets a NodeJS-style callback that can be used to resolve or reject the promise. | ||
*/ | ||
get callback() { | ||
if (!this._callback) { | ||
this._callback = this.createCallback(identity); | ||
} | ||
return this._callback; | ||
} | ||
/** | ||
* Rejects the promise. | ||
* | ||
* @param reason The reason the promise was rejected. | ||
* Creates a NodeJS-style callback that can be used to resolve or reject the promise with multiple values. | ||
*/ | ||
reject(reason) { | ||
this._reject(reason); | ||
createCallback(selector) { | ||
return (err, ...args) => { | ||
if (err !== null && err !== undefined) { | ||
this._reject(err); | ||
} | ||
else { | ||
this._resolve(selector(...args)); | ||
} | ||
}; | ||
} | ||
} | ||
exports.Deferred = Deferred; | ||
function identity(value) { return value; } | ||
//# sourceMappingURL=deferred.js.map |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -44,4 +44,4 @@ /*! ***************************************************************************** | ||
forEach(callback: (value: T, node: LinkedListNode<T>, list: LinkedList<T>) => void, thisArg?: any): void; | ||
private _deleteNode(node); | ||
private _insertNode(adjacentNode, newNode, position); | ||
private _deleteNode; | ||
private _insertNode; | ||
} | ||
@@ -48,0 +48,0 @@ export interface LinkedList<T> { |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -38,20 +38,20 @@ /*! ***************************************************************************** | ||
write(token?: CancellationToken): Promise<LockHandle>; | ||
private _upgrade(token?); | ||
private _processLockRequests(); | ||
private _canTakeReadLock(); | ||
private _processReadLockRequests(); | ||
private _takeReadLock(); | ||
private _releaseReadLock(); | ||
private _canTakeUpgradeableReadLock(); | ||
private _processUpgradeableReadLockRequest(); | ||
private _takeUpgradeableReadLock(); | ||
private _releaseUpgradeableReadLock(); | ||
private _canTakeUpgradeLock(); | ||
private _processUpgradeRequest(); | ||
private _takeUpgradeLock(); | ||
private _releaseUpgradeLock(); | ||
private _canTakeWriteLock(); | ||
private _processWriteLockRequest(); | ||
private _takeWriteLock(); | ||
private _releaseWriteLock(); | ||
private _upgrade; | ||
private _processLockRequests; | ||
private _canTakeReadLock; | ||
private _processReadLockRequests; | ||
private _takeReadLock; | ||
private _releaseReadLock; | ||
private _canTakeUpgradeableReadLock; | ||
private _processUpgradeableReadLockRequest; | ||
private _takeUpgradeableReadLock; | ||
private _releaseUpgradeableReadLock; | ||
private _canTakeUpgradeLock; | ||
private _processUpgradeRequest; | ||
private _takeUpgradeLock; | ||
private _releaseUpgradeLock; | ||
private _canTakeWriteLock; | ||
private _processWriteLockRequest; | ||
private _takeWriteLock; | ||
private _releaseWriteLock; | ||
} | ||
@@ -58,0 +58,0 @@ /** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
@@ -0,0 +0,0 @@ /*! ***************************************************************************** |
{ | ||
"name": "prex", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Async coordination primitives and extensions on top of ES6 Promises", | ||
@@ -43,3 +43,3 @@ "license": "Apache-2.0", | ||
"source-map-support": "^0.2.10", | ||
"typescript": "^2.8.1" | ||
"typescript": "^3.2.2" | ||
}, | ||
@@ -46,0 +46,0 @@ "author": { |
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
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
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
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
187874
0.97%2790
0.72%