mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-14 03:07:57 +01:00
b5fd708971
mindplot lint * fix eqeqeq * fix max-len * fix max-len, guard-for-in * fix import/no-named-as-default-member * misc fixes * fix no-shadow * fix no-param-reassign * fix issues introduced with "fix no-param-reassign" * Merge 'origin/develop' into feature/mindplot-lint * lint and docs fixes after merge Approved-by: Paulo Veiga
23 lines
579 B
JavaScript
23 lines
579 B
JavaScript
import merge from 'lodash/merge';
|
|
|
|
class Options {
|
|
setOptions(...args) {
|
|
const options = merge({}, this.options, ...args);
|
|
this.options = options;
|
|
|
|
if (this.addEvent) {
|
|
const optionsKeys = Object.keys(options);
|
|
for (let index = 0; index < optionsKeys.length; index++) {
|
|
const option = optionsKeys[index];
|
|
if (typeof (options[option]) === 'function' && (/^on[A-Z]/).test(option)) {
|
|
this.addEvent(option, options[option]);
|
|
delete options[option];
|
|
}
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
}
|
|
|
|
export default Options;
|