Class WebAssembly
Class to encapsulate web assembly operations.
Namespace: Evergine.Web
Assembly: Evergine.Web.dll
Syntax
public class WebAssembly
Properties
Runtime
Gets the runtime for interact with JavaScript.
Declaration
public WebAssemblyJSRuntime Runtime { get; }
Property Value
Type | Description |
---|---|
WebAssemblyJSRuntime |
Methods
Dispose()
Dispose object.
Declaration
public void Dispose()
GetElementById(string, bool)
Gets an JSObject by its id.
Declaration
public JSObject GetElementById(string id, bool warn = true)
Parameters
Type | Name | Description |
---|---|---|
string | id | Id of the object. |
bool | warn | Show warning if property is not defined. |
Returns
Type | Description |
---|---|
JSObject | JSObject from the DOM. |
GetGlobalObject(bool)
Get global window object.
Declaration
public JSObject GetGlobalObject(bool warn = true)
Parameters
Type | Name | Description |
---|---|---|
bool | warn | Show warning if property is not defined. |
Returns
Type | Description |
---|---|
JSObject | window object. |
GetInstance()
Gets or creates singleton instance.
Declaration
public static WebAssembly GetInstance()
Returns
Type | Description |
---|---|
WebAssembly | The singleton. |
Invoke(string, bool, params object[])
Invokes the specified JavaScript function synchronously.
Declaration
public void Invoke(string identifier, bool warn = true, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
string | identifier | JavaScript function. |
bool | warn | Show warning if function is not defined. |
object[] | args | Function arguments. |
InvokeRequestAnimationFrameCallback(double)
Invoke draw call.
Declaration
[JSInvokable]
public void InvokeRequestAnimationFrameCallback(double d)
Parameters
Type | Name | Description |
---|---|---|
double | d | Timestamp. |
Invoke<T>(string, bool, params object[])
Invokes the specified JavaScript function synchronously.
Declaration
public T Invoke<T>(string identifier, bool warn = true, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
string | identifier | JavaScript function. |
bool | warn | Show warning if function is not defined. |
object[] | args | Function arguments. |
Returns
Type | Description |
---|---|
T | Function result. |
Type Parameters
Name | Description |
---|---|
T | Return type. |
SetRequestAnimationFrameCallback(Action<double>)
Configures the callback for draw loop and starts it. If callback is null the loop is stopped.
Declaration
public void SetRequestAnimationFrameCallback(Action<double> callback)
Parameters
Type | Name | Description |
---|---|---|
Action<double> | callback | Draw loop callback. |