Skip to content
Discussion options

You must be logged in to vote

For primitives, yes; or rather, it doesn't matter.

For objects, no. objectFromAnotherContext instanceof Object is false because each JSContext has its own copy of the standard global objects like Object, Array, Date, etc.

For consistency, everything takes a pointer to JSContext, also because otherwise you get inconsistencies like:

JSValue JS_NewBool(JSRuntime *rt, bool val);

Vs.

JSValue JS_ToBool(JSRuntime *ctx, JSValueConst val);

The latter needs JSContext because the ToBool operation can invoke JS code.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mrmbernardi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants