Simplify this bindable def by reversing the if/def nest.

Instead of defining the function with an internal if that will always
pick the same path, let's use that if to instead define a
straightforward function that just does what we want.
master
voussoir 2020-10-13 10:53:56 -07:00
parent af4f2bcdaa
commit adddba6c97
1 changed files with 8 additions and 10 deletions

View File

@ -187,19 +187,17 @@ function Editor(elements, on_open, on_save, on_cancel)
return fallback.bind(this); return fallback.bind(this);
} }
const bindable = function()
{
if (this.can_use_element_map) if (this.can_use_element_map)
{ {
func(this, this.edit_element_map, this.display_element_map); const bindable = () => func(this, this.edit_element_map, this.display_element_map);
return bindable.bind(this);
} }
else else
{ {
func(this, this.edit_elements, this.display_elements); const bindable = () => func(this, this.edit_elements, this.display_elements);
}
}
return bindable.bind(this); return bindable.bind(this);
} }
}
const placeholders = document.getElementsByClassName("editor_toolbox_placeholder"); const placeholders = document.getElementsByClassName("editor_toolbox_placeholder");
for (const placeholder of placeholders) for (const placeholder of placeholders)