mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Mention callback argument count in The JavaScript bridge singleton
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
.. _doc_web_javascript_bridge:
|
||||
|
||||
The JavaScriptBridge Singleton
|
||||
The JavaScriptBridge singleton
|
||||
==============================
|
||||
|
||||
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
|
||||
js_event.preventDefault()
|
||||
js_event.returnValue = ''
|
||||
|
||||
.. warning::
|
||||
|
||||
The number of arguments accepted by the callback method (``_my_callback`` in the above example)
|
||||
**must** match the number of arguments sent by JavaScript. Otherwise, the callback method will
|
||||
not be called.
|
||||
|
||||
Here is another example that asks the user for the `Notification permission <https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API>`__
|
||||
and waits asynchronously to deliver a notification if the permission is
|
||||
granted:
|
||||
|
||||
Reference in New Issue
Block a user