27 lines
401 B
JavaScript
27 lines
401 B
JavaScript
const mergeOptions = require('merge-options');
|
|
|
|
const BaseState = require('./BaseState');
|
|
|
|
class SwitchState extends BaseState {
|
|
constructor(cloneObj) {
|
|
super();
|
|
|
|
let cloneState = mergeOptions(SwitchState.default, cloneObj);
|
|
|
|
this.on = cloneState.on;
|
|
}
|
|
|
|
static get default() {
|
|
return {
|
|
on: false
|
|
};
|
|
}
|
|
|
|
get asObj() {
|
|
return {
|
|
on: this.on,
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = SwitchState; |