From 0d3ccb1f6fa0d19b19fb339a3dc1c9e1c929e3e0 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 29 Oct 2024 15:06:02 +0100 Subject: [PATCH] Mention callback argument count in The JavaScript bridge singleton --- tutorials/platform/web/javascript_bridge.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tutorials/platform/web/javascript_bridge.rst b/tutorials/platform/web/javascript_bridge.rst index a3baf9c28..375bb6117 100644 --- a/tutorials/platform/web/javascript_bridge.rst +++ b/tutorials/platform/web/javascript_bridge.rst @@ -1,6 +1,6 @@ .. _doc_web_javascript_bridge: -The JavaScriptBridge Singleton +The JavaScriptBridge singleton ============================== In web builds, the :ref:`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 `__ and waits asynchronously to deliver a notification if the permission is granted: