JSFunction
public final class JSFunction<T> : JSExpression where T : DecodableA JavaScript expression that executes a function in the current JavaScript this. The
 function variable is referenced by a key path relative to the current this.
For instance, to present an alert:
 let alert = JSFunction<JSVoid>("window.alert", arguments: "Hello from Swift!")
 // equivalent to the JS script: `this.window.alert("Hello from Swift!");`
Instances of this class are specialized with the T generic parameter. It must be set to the
 return type of the JavaScript function to execute. Check the documentation of the JavaScript
 function to know what to set the parameter to.
T must be a Decodable type. This includes:
- JSVoidfor functions that do not return a value
- Primitive values (Strings, Numbers, Booleans, …)
- Decodable enumerations
- Objects decodable from JSON
- Arrays of primitive values
- Arrays of enumeration cases
- Arrays of objects
- Native dictionaries
- 
                  
                  DeclarationSwift public typealias ReturnType = T
- 
                  
                  The key path to the function to execute, relative the current thisobject tree.DeclarationSwift public let keyPath: String
- 
                  
                  The arguments to pass to the function. DeclarationSwift public let arguments: [Encodable]
- 
                  
                  Creates a new method description. For instance, to present an alert: let alert = JSFunction<JSVoid>("window.alert", arguments: "Hello from Swift!") // equivalent to the JS script: `this.window.alert("Hello from Swift!");`DeclarationSwift public init(_ keyPath: String, arguments: Encodable...)ParameterskeyPathA dot-separated key path to the function to execute, relative the current thisobject tree.argumentsThe arguments to pass to the function. You can omit this paramter if the JavaScript function you are calling takes no arguments. 
- 
                  
                  Creates the JavaScript text of the expression. DeclarationSwift public func makeExpressionString() throws -> String
 View on GitHub
View on GitHub Install in Dash
Install in Dash JSFunction Class Reference
        JSFunction Class Reference