Commit 476ecb77 by 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.
1 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;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!