Skip to content

Commit 7faaad7

Browse files
Javascript callback function declarations changed (#51)
* Javascript callback function declarations changed * Update snapshots --------- Co-authored-by: Ryan Chandler <ryangjchandler@gmail.com>
1 parent 76f9b9a commit 7faaad7

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

resources/views/components/turnstile.blade.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ class="cf-turnstile"
2727
@if ($model)
2828
<script>
2929
document.addEventListener('livewire:initialized', () => {
30-
function {{ $id }}Callback(token) {
30+
window.{{ $id }}Callback = function (token) {
3131
@this.set("{{ $model }}", token);
3232
}
3333
34-
function {{ $id }}ExpiredCallback() {
34+
window.{{ $id }}ExpiredCallback = function () {
3535
window.turnstile.reset();
3636
}
3737
38-
3938
@this.watch("{{ $model }}", (value, old) => {
4039
// If there was a value, and now there isn't, reset the Turnstile.
4140
if (!!old && !value) {

tests/__snapshots__/TurnstileBladeDirectiveTest__it_can_render_a_turnstile_widget_with_a_custom_ID_and_wire_model__1.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
<script>
55
document.addEventListener('livewire:initialized', () => {
6-
function custom_idCallback(token) {
6+
window.custom_idCallback = function (token) {
77
@this.set("captcha", token);
88
}
99

10-
function custom_idExpiredCallback() {
10+
window.custom_idExpiredCallback = function () {
1111
window.turnstile.reset();
1212
}
1313

14-
1514
@this.watch("captcha", (value, old) => {
1615
// If there was a value, and now there isn't, reset the Turnstile.
1716
if (!!old && !value) {

tests/__snapshots__/TurnstileBladeDirectiveTest__it_can_render_a_turnstile_widget_with_a_wire_model__1.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33

44
<script>
55
document.addEventListener('livewire:initialized', () => {
6-
function captchaCallback(token) {
6+
window.captchaCallback = function (token) {
77
@this.set("captcha", token);
88
}
99

10-
function captchaExpiredCallback() {
10+
window.captchaExpiredCallback = function () {
1111
window.turnstile.reset();
1212
}
1313

14-
1514
@this.watch("captcha", (value, old) => {
1615
// If there was a value, and now there isn't, reset the Turnstile.
1716
if (!!old && !value) {

0 commit comments

Comments
 (0)