Please note, this is a STATIC archive of website from 03 Nov 2016, does not collect or store any user information, there is no "phishing" involved.

This article covers features introduced in SpiderMonkey 31

Initializes the JS engine so that further operations can be performed.


#include "js/Initialization.h" // previously "jsapi.h"



Initialize SpiderMonkey, returning true only if initialization succeeded. Once this method has succeeded, it is safe to call JS_NewRuntime and other JSAPI methods.

This method must be called before any other JSAPI method is used on any thread. Once it has been used, it is safe to call any JSAPI method, and it remains safe to do so until JS_ShutDown is correctly called.

It is currently not possible to initialize SpiderMonkey multiple times (that is, calling JS_Init, JSAPI methods, then JS_ShutDown in that order, then doing so again). This restriction may eventually be lifted.

In the past JS_Init once had the signature JSRuntime * JS_Init(uint32_t maxbytes) and was used to create new JSRuntime instances. This meaning has been removed; use JS_NewRuntime instead.

See Also

Document Tags and Contributors

 Contributors to this page: Waldo, arai, fscholz, tschneidereit, Jorend, Dria, MMondor, Nickolay, Callek, Tservo
 Last updated by: Waldo,