MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / enqueueNew

Method enqueueNew

ui/media/js/engine.js:684–700  ·  view source on GitHub ↗
(task, classCtor, progressCallback)

Source from the content-addressed store, hash-verified

682 return weak_results.get(promiseGenerator)
683 }
684 static enqueueNew(task, classCtor, progressCallback) {
685 if (task.status !== TaskStatus.init) {
686 throw new Error("Task has an invalid status to add to queue.")
687 }
688 if (!(task instanceof classCtor)) {
689 throw new Error("Task is not a instance of classCtor.")
690 }
691 let promiseGenerator = undefined
692 if (typeof progressCallback === "undefined") {
693 promiseGenerator = classCtor.start(task)
694 } else if (typeof progressCallback === "function") {
695 promiseGenerator = classCtor.start(task, progressCallback)
696 } else {
697 throw new Error("progressCallback is not a function.")
698 }
699 return Task.prototype.enqueue.call(task, promiseGenerator)
700 }
701
702 static async run(promiseGenerator, { callback, signal, timeout = -1 } = {}) {
703 let value = undefined

Callers 2

enqueueMethod · 0.80
enqueueMethod · 0.80

Calls 1

startMethod · 0.45

Tested by

no test coverage detected