MCPcopy Create free account
hub / github.com/SocketCluster/socketcluster / _waitForNextItem

Method _waitForNextItem

app/public/socketcluster-client.js:8685–8704  ·  view source on GitHub ↗
(timeout)

Source from the content-addressed store, hash-verified

8683 }
8684
8685 async _waitForNextItem(timeout) {
8686 return new Promise((resolve, reject) => {
8687 this._resolve = resolve;
8688 let timeoutId;
8689 if (timeout !== undefined) {
8690 // Create the error object in the outer scope in order
8691 // to get the full stack trace.
8692 let error = new Error('Stream consumer iteration timed out');
8693 (async () => {
8694 let delay = wait(timeout);
8695 timeoutId = delay.timeoutId;
8696 await delay.promise;
8697 error.name = 'TimeoutError';
8698 delete this._resolve;
8699 reject(error);
8700 })();
8701 }
8702 this._timeoutId = timeoutId;
8703 });
8704 }
8705
8706 async next() {
8707 this.stream.setConsumer(this.id, this);

Callers 1

nextMethod · 0.95

Calls 1

waitFunction · 0.85

Tested by

no test coverage detected