JavaScript.xml 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="JavaScript" inherits="Object" category="Core" version="3.1">
  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/latest/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script</link>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="eval">
  16. <return type="Variant">
  17. </return>
  18. <argument index="0" name="code" type="String">
  19. </argument>
  20. <argument index="1" name="use_global_execution_context" type="bool" default="false">
  21. </argument>
  22. <description>
  23. 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].
  24. 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.
  25. </description>
  26. </method>
  27. </methods>
  28. <constants>
  29. </constants>
  30. </class>