Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com 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.

Syntax

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

bool
JS_Init(void);

Description

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,