The C++ engine is just the underlying implementation of the JS
paradigm, so, the logic will be the same as your script, but low
level.
1 Create the variable handle
2 Assign it a value (such as object, array, function, string, etc.)
3 Define it on an object (such as the global scope)
You will have to follow these steps to define each and every property
or method.
You can also set flags such as read only, permanent, enumerable, etc.
You can also define prototypes and instantiate objects from those
types instead of just generic objects.
see:
JS::RootedValue and (.setString or .setObject or .setBoolean or ...)
JS_DefineFunction or JS_SetFunction
JS_DefineProperty or JS_SetProperty
JS_DefineElement or JS_SetElement
and:
JSPROP_PERMANENT and ...
JSClass and JSClassOps and JS_InitClass
> _______________________________________________
> dev-tech-js-engine mailing list
>
dev-tech-...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/dev-tech-js-engine
>