Skip to content

Commit 63a0fc6

Browse files
committed
Fix: Remote access fails if buffer names collide with JS object keywords (i.e. "length" in Audio Oscilloscope).
1 parent 74c0866 commit 63a0fc6

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

‎index.html‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,28 +219,29 @@
219219
if (ve["dataInput"][index] == null)
220220
continue;
221221
let varStr = ve["dataInput"][index];
222+
let varKey = "buffer:" + varStr;
222223
if (ve["updateMode"] == "single" || ve["updateMode"] == "input") {
223224
if (modePriority[varStr] >= 1)
224225
continue;
225-
usedVars[varStr] = composeVarStr(varStr, "single");
226-
modePriority[varStr] = 1;
226+
usedVars[varKey] = composeVarStr(varStr, "single");
227+
modePriority[varKey] = 1;
227228
} else if (ve["updateMode"] == "partial") {
228-
if (modePriority[varStr] >= 2)
229+
if (modePriority[varKey] >= 2)
229230
continue;
230231
var dependentVar = ((ve["dataInput"].length > index + 1) && (index % 2 == 0)) ? ve["dataInput"][index+1] : ve["dataInput"][index];
231-
usedVars[varStr] = composeVarStr(varStr, "partial", dependentVar);
232-
modePriority[varStr] = 2;
232+
usedVars[varKey] = composeVarStr(varStr, "partial", dependentVar);
233+
modePriority[varKey] = 2;
233234
} else if (ve["updateMode"] == "partialXYZ") {
234-
if (modePriority[varStr] >= 3)
235+
if (modePriority[varKey] >= 3)
235236
continue;
236237
var dependentVar = ve["dataInput"][Math.floor(index / 3)];
237-
usedVars[varStr] = composeVarStr(varStr, "partialXYZ", dependentVar);
238-
modePriority[varStr] = 3;
238+
usedVars[varKey] = composeVarStr(varStr, "partialXYZ", dependentVar);
239+
modePriority[varKey] = 3;
239240
} else if (ve["updateMode"] == "full") {
240-
if (modePriority[varStr] >= 4)
241+
if (modePriority[varKey] >= 4)
241242
continue;
242-
usedVars[varStr] = composeVarStr(varStr, "full");
243-
modePriority[varStr] = 4;
243+
usedVars[varKey] = composeVarStr(varStr, "full");
244+
modePriority[varKey] = 4;
244245
}
245246
}
246247
}

0 commit comments

Comments
 (0)