MCPcopy Create free account
hub / github.com/denodrivers/postgres / pop

Method pop

utils/deferred.ts:104–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102 }
103
104 async pop(): Promise<T> {
105 let element: T;
106 if (this.available > 0) {
107 element = this.#elements.pop()!;
108 } else {
109 // If there are not elements left in the stack, it will await the call until
110 // at least one is restored and then return it
111 const d = Promise.withResolvers<T>();
112 this.#queue.push(d);
113 element = await d.promise;
114 }
115
116 if (!(await this.#checkElementInitialization(element))) {
117 await this.#initializeElement(element);
118 }
119 return element;
120 }
121
122 push(value: T): void {
123 // If an element has been requested while the stack was empty, indicate

Callers

nothing calls this directly

Calls 2

popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected