Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/nodejs/jsdom/lib/jsdom/browser/resources/ drwxr-xr-x |
Viewing file: Select action/file-type: "use strict"; class QueueItem { constructor(onLoad, onError, dependentItem) { this.onLoad = onLoad; this.onError = onError; this.data = null; this.error = null; this.dependentItem = dependentItem; } } /** * AsyncResourceQueue is the queue in charge of run the async scripts * and notify when they finish. */ module.exports = class AsyncResourceQueue { constructor() { this.items = new Set(); this.dependentItems = new Set(); } count() { return this.items.size + this.dependentItems.size; } _notify() { if (this._listener) { this._listener(); } } _check(item) { let promise; if (item.onError && item.error) { promise = item.onError(item.error); } else if (item.onLoad && item.data) { promise = item.onLoad(item.data); } promise .then(() => { this.items.delete(item); this.dependentItems.delete(item); if (this.count() === 0) { this._notify(); } }); } setListener(listener) { this._listener = listener; } push(request, onLoad, onError, dependentItem) { const q = this; const item = new QueueItem(onLoad, onError, dependentItem); q.items.add(item); return request .then(data => { item.data = data; if (dependentItem && !dependentItem.finished) { q.dependentItems.add(item); return q.items.delete(item); } if (onLoad) { return q._check(item); } q.items.delete(item); if (q.count() === 0) { q._notify(); } return null; }) .catch(err => { item.error = err; if (dependentItem && !dependentItem.finished) { q.dependentItems.add(item); return q.items.delete(item); } if (onError) { return q._check(item); } q.items.delete(item); if (q.count() === 0) { q._notify(); } return null; }); } notifyItem(syncItem) { for (const item of this.dependentItems) { if (item.dependentItem === syncItem) { this._check(item); } } } }; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0032 ]-- |