Skip to content

Commit eb01c7c

Browse files
authored
Merge pull request #10162 from Calinou/javascript-bridge-callback-argument-count
Mention callback argument count in The JavaScript bridge singleton
2 parents 367c80c + 0d3ccb1 commit eb01c7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tutorials/platform/web/javascript_bridge.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _doc_web_javascript_bridge:
22

3-
The JavaScriptBridge Singleton
3+
The JavaScriptBridge singleton
44
==============================
55

66
In web builds, the :ref:`JavaScriptBridge <class_JavaScriptBridge>` singleton
@@ -93,6 +93,12 @@ Arguments passed by JavaScript to the callback will be passed as a single Godot
9393
js_event.preventDefault()
9494
js_event.returnValue = ''
9595
96+
.. warning::
97+
98+
The number of arguments accepted by the callback method (``_my_callback`` in the above example)
99+
**must** match the number of arguments sent by JavaScript. Otherwise, the callback method will
100+
not be called.
101+
96102
Here is another example that asks the user for the `Notification permission <https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API>`__
97103
and waits asynchronously to deliver a notification if the permission is
98104
granted:

0 commit comments

Comments
 (0)