26 lines
504 B
JavaScript
26 lines
504 B
JavaScript
import { BridgeComponent } from "@hotwired/hotwire-native-bridge"
|
|
|
|
export default class extends BridgeComponent {
|
|
static component = "text-size"
|
|
|
|
connect() {
|
|
super.connect()
|
|
this.notifyBridgeOfConnect()
|
|
}
|
|
|
|
disconnect() {
|
|
super.disconnect()
|
|
this.send("disconnect")
|
|
}
|
|
|
|
notifyBridgeOfConnect() {
|
|
this.send("connect", {}, message => {
|
|
this.#setTextSize(message.data)
|
|
})
|
|
}
|
|
|
|
#setTextSize(data) {
|
|
document.documentElement.dataset.textSize = data.textSize
|
|
}
|
|
}
|