Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
Luke Schoen
committed
import { DEFAULT_OPTIONS, TASKBAR_OPTIONS } from './config';
let hasCalledInitFetherAppOptions = false;
class FetherAppOptions {
options = {};
Luke Schoen
committed
create = (withTaskbar, customOptions) => {
if (hasCalledInitFetherAppOptions) {
throw new Error('Unable to initialise Fether app options more than once');
}
Luke Schoen
committed
// Allow user to get/set options prior or to pass custom options
this.options = withTaskbar
Luke Schoen
committed
? Object.assign(
Luke Schoen
committed
this.options,
DEFAULT_OPTIONS,
TASKBAR_OPTIONS,
customOptions || {}
)
Luke Schoen
committed
: Object.assign(this.options, DEFAULT_OPTIONS, customOptions || {});
return this.options;
};
Luke Schoen
committed
get = opt => {
return this.options[opt];
};
set = (opt, val) => {
this.options[opt] = val;
};
}
export default FetherAppOptions;