Add scope selector value
This commit is contained in:
@@ -2,10 +2,13 @@ import { BridgeComponent } from "@hotwired/hotwire-native-bridge"
|
||||
|
||||
export default class extends BridgeComponent {
|
||||
static component = "stamp"
|
||||
static values = { scopeSelector: { type: String, default: "body" } }
|
||||
|
||||
connect() {
|
||||
super.connect()
|
||||
this.notifyBridgeOfConnect()
|
||||
if (this.element.closest(this.scopeSelectorValue)) {
|
||||
super.connect()
|
||||
this.send("connect", this.#data)
|
||||
}
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
@@ -13,10 +16,6 @@ export default class extends BridgeComponent {
|
||||
this.send("disconnect")
|
||||
}
|
||||
|
||||
notifyBridgeOfConnect() {
|
||||
this.send("connect", this.#data)
|
||||
}
|
||||
|
||||
get #data() {
|
||||
const bridgeElement = this.bridgeElement
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user