nighthouse
Advanced tools
Comparing version 2.1.5 to 2.1.6
@@ -157,11 +157,16 @@ "use strict"; | ||
this.logger.trace(`Pushing promise for next response to request ${id}`); | ||
const deferred = new deferred_1.Deferred(); | ||
this.responseHandlers.set(id, deferred); | ||
nextPromises.push(deferred.promise.then(message => { | ||
const responseHandler = new deferred_1.Deferred(); | ||
this.responseHandlers.set(id, responseHandler); | ||
const nextDeferred = new deferred_1.Deferred(); | ||
nextPromises.push(nextDeferred.promise); | ||
responseHandler.promise | ||
.then(response => { | ||
pushPromise(); | ||
return message; | ||
})); | ||
nextDeferred.resolve(response); | ||
}) | ||
.catch(nextDeferred.reject); | ||
}; | ||
pushPromise(); | ||
while (true) { | ||
console.assert(nextPromises.length > 0); | ||
const promise = nextPromises.shift(); | ||
@@ -168,0 +173,0 @@ yield await promise; |
{ | ||
"name": "nighthouse", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Lightweight Project Lighthouse client for JavaScript", | ||
@@ -5,0 +5,0 @@ "workspaces": [ |
@@ -181,8 +181,15 @@ import { Transport } from "./transport"; | ||
this.logger.trace(`Pushing promise for next response to request ${id}`); | ||
const deferred = new Deferred<ServerMessage<unknown>>(); | ||
this.responseHandlers.set(id, deferred); | ||
nextPromises.push(deferred.promise.then(message => { | ||
pushPromise(); | ||
return message; | ||
})); | ||
const responseHandler = new Deferred<ServerMessage<unknown>>(); | ||
this.responseHandlers.set(id, responseHandler); | ||
const nextDeferred = new Deferred<ServerMessage<unknown>>(); | ||
nextPromises.push(nextDeferred.promise); | ||
responseHandler.promise | ||
.then(response => { | ||
pushPromise(); | ||
nextDeferred.resolve(response); | ||
}) | ||
.catch(nextDeferred.reject); | ||
} | ||
@@ -193,2 +200,3 @@ | ||
while (true) { | ||
console.assert(nextPromises.length > 0); | ||
const promise = nextPromises.shift(); | ||
@@ -195,0 +203,0 @@ yield await promise; |
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
130021
1560