JavaScript.xml 1.4 KB

12345678910111213141516171819202122232425262728
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="JavaScript" inherits="Object" category="Core" version="3.1.2">
  3. <brief_description>
  4. Singleton that connects the engine with the browser's JavaScript context in HTML5 export.
  5. </brief_description>
  6. <description>
  7. The JavaScript singleton is implemented only in HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/3.1/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script</link>
  11. </tutorials>
  12. <methods>
  13. <method name="eval">
  14. <return type="Variant">
  15. </return>
  16. <argument index="0" name="code" type="String">
  17. </argument>
  18. <argument index="1" name="use_global_execution_context" type="bool" default="false">
  19. </argument>
  20. <description>
  21. Execute the string [code]code[/code] as JavaScript code within the browser window. This is a call to the actual global JavaScript function [code]eval()[/code].
  22. If [code]use_global_execution_context[/code] is [code]true[/code], the code will be evaluated in the global execution context. Otherwise, it is evaluated in the execution context of a function within the engine's runtime environment.
  23. </description>
  24. </method>
  25. </methods>
  26. <constants>
  27. </constants>
  28. </class>