Contents

current()

Returns the context currently executing JavaScript code.

Declaration

class func current() -> JSContext!

Return Value

The currently executing context, or nil if not within native code called from JavaScript.

Discussion

Call this method within an Objective-C or Swift block or method invoked from within JavaScript to obtain the JSContext object responsible for executing that Javascript code.

If not currently in code invoked as a callback from JavaScript, this method returns nil.

See Also

Inspecting callback state in a running context