Instance Method

initWithVirtualMachine:

Creates a new JavaScript context associated with a specific virtual machine.

Declaration

- (instancetype)initWithVirtualMachine:(JSVirtualMachine *)virtualMachine;

Parameters

virtualMachine

The virtual machine with which to associate the new context.

Return Value

A new JavaScript context.

Discussion

By default, each context has an independent virtual machine (a JSVirtualMachine object). You cannot pass JavaScript values between contexts in different virtual machines. Use this initializer to create a context that shares its virtual machine with other JavaScript contexts to allow passing JSValue objects between those contexts.

See Also

Creating JavaScript Contexts

- init

Initializes a new JavaScript context.