⌈⌋ ⎇ branch:  Bitrhythm


Artifact Content

Artifact bae8da53ce7820029a35d38f407d518f0c9fc42dde5144ff5c790783ac50260c:


'use strict';

export default class Toggle {

  constructor(state) {
    this.state = state || false;
  }

  flip(state) {
    if (state || state === false) {
      this.state = state;
    } else {
      this.state = !this.state;
    }
  }

  on() {
    this.state = true;
  }

  off() {
    this.state = false;
  }

}