Use fire() instead of dispatch()
Addresses Copilot's feedback
This commit is contained in:
@@ -3,7 +3,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
export default class extends Controller {
|
||||
static values = { name: String }
|
||||
|
||||
dispatch() {
|
||||
document.dispatchEvent(new CustomEvent(this.nameValue, { bubbles: true }))
|
||||
fire() {
|
||||
this.dispatch(this.nameValue, { target: document, prefix: false })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<h3 class="margin-block-end-half txt-normal">Remember to export your data</h3>
|
||||
<p class="margin-block-start-half margin-block-end">
|
||||
<button type="button" class="btn btn--plain txt-link" data-controller="dispatch-event" data-dispatch-event-name-value="open-export" data-action="click->dialog#close click->dispatch-event#dispatch">Export your data</button> before you go. You won’t be able to do it after you cancel your account.
|
||||
<button type="button" class="btn btn--plain txt-link" data-controller="dispatch-event" data-dispatch-event-name-value="open-export" data-action="click->dialog#close click->dispatch-event#fire">Export your data</button> before you go. You won’t be able to do it after you cancel your account.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user