Sha256: 22375515dbeba6d4b51b904c31bc9add92647688b67560c033f5b70535c27790
Contents?: true
Size: 666 Bytes
Versions: 13
Compression:
Stored size: 666 Bytes
Contents
import { Controller } from "@hotwired/stimulus"; export default class StatusBarController extends Controller { connect() { // cache the version's state in the controller on connect this.versionState = this.element.dataset.state; } morph(e) { if (e.target !== this.element) return; this.versionState = this.element.dataset.state; this.update({ dirty: false }); } change(e) { if (e.detail && e.detail.hasOwnProperty("dirty")) { this.update(e.detail); } } update({ dirty }) { if (dirty) { this.element.dataset.state = "dirty"; } else { this.element.dataset.state = this.versionState; } } }
Version data entries
13 entries across 13 versions & 2 rubygems