- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
41 lines
1.8 KiB
JavaScript
41 lines
1.8 KiB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
};
|
|
var _PriorityQueue_queue;
|
|
import lowerBound from './lower-bound.js';
|
|
class PriorityQueue {
|
|
constructor() {
|
|
_PriorityQueue_queue.set(this, []);
|
|
}
|
|
enqueue(run, options) {
|
|
options = {
|
|
priority: 0,
|
|
...options,
|
|
};
|
|
const element = {
|
|
priority: options.priority,
|
|
run,
|
|
};
|
|
if (this.size && __classPrivateFieldGet(this, _PriorityQueue_queue, "f")[this.size - 1].priority >= options.priority) {
|
|
__classPrivateFieldGet(this, _PriorityQueue_queue, "f").push(element);
|
|
return;
|
|
}
|
|
const index = lowerBound(__classPrivateFieldGet(this, _PriorityQueue_queue, "f"), element, (a, b) => b.priority - a.priority);
|
|
__classPrivateFieldGet(this, _PriorityQueue_queue, "f").splice(index, 0, element);
|
|
}
|
|
dequeue() {
|
|
const item = __classPrivateFieldGet(this, _PriorityQueue_queue, "f").shift();
|
|
return item === null || item === void 0 ? void 0 : item.run;
|
|
}
|
|
filter(options) {
|
|
return __classPrivateFieldGet(this, _PriorityQueue_queue, "f").filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
}
|
|
get size() {
|
|
return __classPrivateFieldGet(this, _PriorityQueue_queue, "f").length;
|
|
}
|
|
}
|
|
_PriorityQueue_queue = new WeakMap();
|
|
export default PriorityQueue;
|