Search Results for

    Show / Hide Table of Contents

    Class JSObject

    Represents a reference to a JavaScript object.

    Inheritance
    object
    JSObject
    Namespace: Evergine.Web
    Assembly: Evergine.Web.dll
    Syntax
    public class JSObject

    Constructors

    JSObject(IJSInProcessObjectReference)

    Initializes a new instance of the JSObject class.

    Declaration
    public JSObject(IJSInProcessObjectReference reference)
    Parameters
    Type Name Description
    IJSInProcessObjectReference reference

    Internal object reference.

    JSObject(IJSObjectReference)

    Initializes a new instance of the JSObject class.

    Declaration
    public JSObject(IJSObjectReference reference)
    Parameters
    Type Name Description
    IJSObjectReference reference

    Internal object reference.

    Properties

    Reference

    Gets the JavaScrtipt reference of the object.

    Declaration
    public IJSInProcessObjectReference Reference { get; }
    Property Value
    Type Description
    IJSInProcessObjectReference

    Methods

    AddEventCustomListener(string, Action<string>, string, params object[])

    Add event listener to object that retunrs a custom summary output in the form of a string. This version is the most efficient and should be prefered when event data is needed back in evergine.

    Declaration
    public void AddEventCustomListener(string eventName, Action<string> listener, string summaryFn, params object[] options)
    Parameters
    Type Name Description
    string eventName

    Name of the event that triggers the listener.

    Action<string> listener

    Action method to be called.

    string summaryFn

    Javascript global function that will process the output before sending it. fn(src, event) -> string.

    object[] options

    Optional parameters.

    AddEventListener(string, Action<JSObject>, params object[])

    Add event listener to object. This version is the slowest and should be avoided when event is going to trigger a lot.

    Declaration
    public void AddEventListener(string eventName, Action<JSObject> listener, params object[] options)
    Parameters
    Type Name Description
    string eventName

    Name of the event that triggers the listener.

    Action<JSObject> listener

    Action method to be called.

    object[] options

    Optional parameters.

    AddSimpleEventListener(string, Action, params object[])

    Add simple event listener to object. The listener does not use event information but it the most efficient implementation.

    Declaration
    public void AddSimpleEventListener(string eventName, Action listener, params object[] options)
    Parameters
    Type Name Description
    string eventName

    Name of the event that triggers the listener.

    Action listener

    Action method to be called.

    object[] options

    Optional parameters.

    Dispose()

    Dispose the object.

    Declaration
    public void Dispose()

    GetObjectProperty<T>(string, bool)

    Access JSObject property.

    Declaration
    public T GetObjectProperty<T>(string property, bool warn = true)
    Parameters
    Type Name Description
    string property

    Name of the property.

    bool warn

    Show warning if property is not defined.

    Returns
    Type Description
    T

    Property value. Null if it does not exists.

    Type Parameters
    Name Description
    T

    Type of the property.

    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.

    InvokeEventCustomListener(string, string)

    Callback for event listeners.

    Declaration
    [JSInvokable]
    public void InvokeEventCustomListener(string eventName, string output)
    Parameters
    Type Name Description
    string eventName

    Type of event.

    string output

    Custom output received from javascript.

    InvokeEventListener(string, IJSObjectReference)

    Callback for event listeners.

    Declaration
    [JSInvokable]
    public void InvokeEventListener(string eventName, IJSObjectReference el)
    Parameters
    Type Name Description
    string eventName

    Type of event.

    IJSObjectReference el

    Event element.

    InvokeEventListenerSimple(string)

    Faster implementation of callback for event listeners, but without event information.

    Declaration
    [JSInvokable]
    public void InvokeEventListenerSimple(string eventName)
    Parameters
    Type Name Description
    string eventName

    Type of event.

    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. default(T) if it does not exists.

    Type Parameters
    Name Description
    T

    Return type.

    RemoveEventListener(string, params object[])

    Remove event listener from object.

    Declaration
    public void RemoveEventListener(string eventName, params object[] options)
    Parameters
    Type Name Description
    string eventName

    Name of the event that triggers the listener.

    object[] options

    Optional parameters.

    SetObjectProperty<T>(string, T, bool)

    Sets JSObject property.

    Declaration
    public void SetObjectProperty<T>(string property, T value, bool warn = true)
    Parameters
    Type Name Description
    string property

    Name of the property.

    T value

    Value of the property.

    bool warn

    Show warning if function is not defined.

    Type Parameters
    Name Description
    T

    Type of the property.

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In this article
    Back to top
    Generated by DocFX