From 02ee04797cd8806717528665b59cd07296fffe06 Mon Sep 17 00:00:00 2001 From: ezsh <ezsh.junk@gmail.com> Date: Fri, 24 Apr 2020 15:05:57 +0200 Subject: [PATCH] Add slaveStateById() function --- devTools/FC.d.ts | 2 ++ src/js/assayJS.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/devTools/FC.d.ts b/devTools/FC.d.ts index c1ffd2605dd..fb1c648d673 100644 --- a/devTools/FC.d.ts +++ b/devTools/FC.d.ts @@ -17,6 +17,8 @@ interface Window { rulesAutosurgery: any; ruleApplied: any; SlaveSummary: any; + + slaveStateById(id: number): App.Entity.SlaveState; } declare namespace App { diff --git a/src/js/assayJS.js b/src/js/assayJS.js index e6b18003a77..ece61679cb8 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -285,6 +285,15 @@ window.getSlave = function getSlave(ID) { return index === undefined ? undefined : State.variables.slaves[index]; }; +/** + * @param {number} ID + * @returns {App.Entity.SlaveState} + */ +window.slaveStateById = function(ID) { + const index = State.variables.slaveIndices[ID]; + return index === undefined ? undefined : State.variables.slaves[index]; +}; + window.getChild = function getChild(ID) { return State.variables.cribs.find(s => s.ID === ID); }; -- GitLab