JSCFunction
Inherits Invokable / JSObjectUtils / Reference / Object
JSCFunction represents a JavaScript's native function(a function that run native code instead of javascript).
Constants
FUNCTIONS = [] of JSCFunction
Constructors
new(func : Array(JSCPrimative | JSCFunction | JSCObject) -> _, name : String | Nil = nil, auto_save : Bool = true)
Initializes a JavaScript native function.
For short, uses WebExtension.function macro instead.
NOTE: IMPORTANT. Does not directly use parameter as return value. The following code won't work.
WebExtension.function params do
params.first # => Directly returns function parameter(s) is not recommended and may crash program
end
Class methods
Instance methods
call(*args)
Calls the function.
E.g:
sum_function.call JSCPrimative.new(1), 2
NOTE: Calling function this way won't make JS this operator usable. In case of
invoking object's method, uses Invokable#invoke instead.
finalize
Source