JavaScriptKit Documentation

Class JSOneshot​Closure

public class JSOneshotClosure: JSObject, JSClosureProtocol  

JSOneshotClosure is a JavaScript function that can be called only once. This class can be used for optimized memory management when compared to the common JSClosure.

%163 JSOneshotClosure JSOneshotClosure JSClosureProtocol JSClosureProtocol JSOneshotClosure->JSClosureProtocol JSObject JSObject JSOneshotClosure->JSObject

Superclass

JSObject

JSObject represents an object in JavaScript and supports dynamic member lookup. Any member access like object.foo will dynamically request the JavaScript and Swift runtime bridge library for a member with the specified name in this object.

Conforms To

JSClosureProtocol

JSClosureProtocol wraps Swift closure objects for use in JavaScript. Conforming types are responsible for managing the lifetime of the closure they wrap, but can delegate that task to the user by requiring an explicit release() call.

Initializers

init(_:​file:​line:​)

public init(_ body: @escaping ([JSValue]) -> JSValue, file: String = #fileID, line: UInt32 = #line)  

Methods

release()

public func release()  

Release this function resource. After calling release, calling this function from JavaScript will fail.