pub struct JSContextGroup { /* private fields */ }Expand description
A group that associates JavaScript contexts with one another.
Contexts in the same group may share and exchange JavaScript objects. Sharing and/or exchanging JavaScript objects between contexts in different groups will produce undefined behavior. When objects from the same context group are used in multiple threads, explicit synchronization is required.
Implementations§
Source§impl JSContextGroup
impl JSContextGroup
Sourcepub fn new_context(&self) -> JSContext
pub fn new_context(&self) -> JSContext
Creates a global JavaScript execution context in this context group.
This allocates a global object and populates it with all the
built-in JavaScript objects, such as Object, Function,
String, and Array.
The created global context retains this group.
Sourcepub fn new_context_with_class(&self, global_object_class: &JSClass) -> JSContext
pub fn new_context_with_class(&self, global_object_class: &JSClass) -> JSContext
Creates a global JavaScript execution context in this context group.
This allocates a global object and populates it with all the
built-in JavaScript objects, such as Object, Function,
String, and Array.
The created global context retains this group.
global_object_class: The class to use when creating the global object.