Activable
A base class that implements active-related functionalities.
Install
$ npm install --save activable
Usage
; {} const engine = ; engine; // falseengine;engine; // trueengine;engine; // false
API
new Activable ( active?: boolean )
Returns a new instance of Activable, with a status of active
, if provided, or false.
.isActive (): boolean
Returns a boolean indicating the state of the instance.
.activate (): this
.isActive ()
will return true.
.deactivate (): this
.isActive ()
will return false.
.toggleActive ( active: boolean = !this.isActive () ): this
If active
is provided, the status will be set to its value.
Otherwise it will flip the current value.
License
MIT © Fabio Spampinato