Commit 476ecb77 authored by Tomáš Peterka's avatar Tomáš Peterka

Gadget state does not get modified by `undefined`

=================================================

Gadget does not take `undefined` arguments as a change to context.

This makes using of default state almost boiler-plate free. Allows to
easily avoid unnecessary changes by having `undefined` in default state.

For explicite zeroing the state attribute, one should use `null` value.
parent a5273d87
......@@ -668,7 +668,8 @@
}
for (key in state_dict) {
if (state_dict.hasOwnProperty(key) &&
(state_dict[key] !== context.state[key])) {
state_dict[key] !== undefined &&
state_dict[key] !== context.state[key]) {
context.state[key] = state_dict[key];
modification_dict[key] = state_dict[key];
modified = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment