hm
This commit is contained in:
parent
7455d630fc
commit
4d3fc2cd47
84 changed files with 3429 additions and 3480 deletions
29
js/update_step_pipeline_runner.js
Normal file
29
js/update_step_pipeline_runner.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
// Layer: shared-runtime/pipeline
|
||||
// Small helper for explicit ordered update-step pipelines.
|
||||
(function (global) {
|
||||
function create(stepNames, invokeStep) {
|
||||
const names = Object.freeze([...(stepNames || [])]);
|
||||
let cachedSteps = null;
|
||||
|
||||
function steps() {
|
||||
if (!cachedSteps) cachedSteps = names.map(name => global[name]);
|
||||
return cachedSteps;
|
||||
}
|
||||
|
||||
function run(...args) {
|
||||
const concrete = steps();
|
||||
if (concrete.length !== names.length || concrete.some(step => !step || typeof step.update !== "function")) return false;
|
||||
for (const step of concrete) {
|
||||
const result = invokeStep(step, ...args) || {};
|
||||
if (result.done) return result.ok !== false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return Object.freeze({ run });
|
||||
}
|
||||
|
||||
global.TarinaiUpdateStepPipelineRunner = Object.freeze({ create });
|
||||
})(typeof window !== "undefined" ? window : globalThis);
|
||||
Loading…
Add table
Add a link
Reference in a new issue