Skip to content

JSFunction structure

Represents a JavaScript Function value.

C#
public struct JSFunction : IJSValue<JSFunction>

Public Members

namedescription
JSFunction(…)Creates a new unnamed JS function with a callback and optional callback data. (26 constructors)
Name { get; }Gets the name of the function, or an empty string if the function is unnamed.
Apply(…)Calls the function with the specified this value. (3 methods)
As<T>()Tries to create a T struct from this instance. It returns null if the T struct cannot be created.
AsUnchecked<T>()Creates a T struct from this instance without checking the enclosed handle type. It must be used only when the handle type is known to be correct.
Bind(…)Creates a new function that when called has the specified this value, and optionally the specified sequence of arguments preceding any provided when the new function is called.
Call(…)(5 methods)
CallAsConstructor(…)
CallAsStatic()
CallAsStatic(…)(4 methods)
CastTo<T>()Creates a T struct from this instance. It throws InvalidCastException in case of failure.
Equals(…)Compares two JS values using JS "strict" equality.
override Equals(…)
override GetHashCode()
Is<T>()Checks if the T struct can be created from this instance`.
operator ==Compares two JS values using JS "strict" equality.
explicit operatorExplicitly converts a JSValue to a nullable JSFunction. (2 operators)
implicit operatorImplicitly converts a JSFunction to a JSValue.
operator !=Compares two JS values using JS "strict" equality.

See Also

Released under the MIT license