fix: binding more than one struct method (#245)

This commit is contained in:
Lea Anthony
2019-10-01 06:13:55 +10:00
committed by GitHub
parent c375c281ee
commit 12ff0f8c97
3 changed files with 6 additions and 4 deletions

View File

@@ -46,13 +46,15 @@ export function NewBinding(bindingName) {
// Check if we have a path (IE Struct)
if (bindingSections.length > 1) {
// Iterate over binding sections, adding them to the window.backend object
for (let index = 0; index < bindingSections.length - 1; index += 1) {
for (let index = 0; index < bindingSections.length-1; index += 1) {
const name = bindingSections[index];
// Is name a valid javascript identifier?
if (!isValidIdentifier(name)) {
return new Error(`${name} is not a valid javascript identifier.`);
}
pathToBinding[name] = {};
if (!pathToBinding[name]) {
pathToBinding[name] = {};
}
pathToBinding = pathToBinding[name];
}
}