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.
This commit is contained in:
parent
af4f2bcdaa
commit
adddba6c97
1 changed files with 8 additions and 10 deletions
|
@ -187,19 +187,17 @@ function Editor(elements, on_open, on_save, on_cancel)
|
|||
return fallback.bind(this);
|
||||
}
|
||||
|
||||
const bindable = function()
|
||||
{
|
||||
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
|
||||
{
|
||||
func(this, this.edit_elements, this.display_elements);
|
||||
}
|
||||
}
|
||||
const bindable = () => func(this, this.edit_elements, this.display_elements);
|
||||
return bindable.bind(this);
|
||||
}
|
||||
}
|
||||
|
||||
const placeholders = document.getElementsByClassName("editor_toolbox_placeholder");
|
||||
for (const placeholder of placeholders)
|
||||
|
|
Loading…
Reference in a new issue