JavaScriptBridge

package
v0.0.0-...-f3deeb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package JavaScriptBridge provides methods for working with JavaScriptBridge object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advanced

func Advanced() class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

func CreateCallback

func CreateCallback(callable Callable.Function) [1]gdclass.JavaScriptObject

Creates a reference to a [Callable] that can be used as a callback by JavaScript. The reference must be kept until the callback happens, or it won't be called at all. See [JavaScriptObject] for usage.

func DownloadBuffer

func DownloadBuffer(buffer []byte, name string)

Prompts the user to download a file containing the specified [param buffer]. The file will have the given [param name] and [param mime] type. [b]Note:[/b] The browser may override the [url=https://en.wikipedia.org/wiki/Media_type]MIME type[/url] provided based on the file [param name]'s extension. [b]Note:[/b] Browsers might block the download if [method download_buffer] is not being called from a user interaction (e.g. button click). [b]Note:[/b] Browsers might ask the user for permission or block the download if multiple download requests are made in a quick succession.

func Eval

func Eval(code string) any

Execute the string [param code] as JavaScript code within the browser window. This is a call to the actual global JavaScript function [code skip-lint]eval()[/code]. If [param use_global_execution_context] 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.

func ForceFsSync

func ForceFsSync()

Force synchronization of the persistent file system (when enabled). [b]Note:[/b] This is only useful for modules or extensions that can't use [FileAccess] to write files.

func GetInterface

func GetInterface(intf string) [1]gdclass.JavaScriptObject

Returns an interface to a JavaScript object that can be used by scripts. The [param interface] must be a valid property of the JavaScript [code]window[/code]. The callback must accept a single [Array] argument, which will contain the JavaScript [code]arguments[/code]. See [JavaScriptObject] for usage.

func OnPwaUpdateAvailable

func OnPwaUpdateAvailable(cb func())

func PwaNeedsUpdate

func PwaNeedsUpdate() bool

Returns [code]true[/code] if a new version of the progressive web app is waiting to be activated. [b]Note:[/b] Only relevant when exported as a Progressive Web App.

func PwaUpdate

func PwaUpdate() error

Performs the live update of the progressive web app. Forcing the new version to be installed and the page to be reloaded. [b]Note:[/b] Your application will be [b]reloaded in all browser tabs[/b]. [b]Note:[/b] Only relevant when exported as a Progressive Web App and [method pwa_needs_update] returns [code]true[/code].

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL