Obsolete since JSAPI 26
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Determine whether the currently executing
JSNative was called as a constructor.
JSBool JS_IsConstructing(JSContext *cx, jsval *vp);
JS_IsConstructing must be called only from a
JSNative called from the engine. cx and vp must be the arguments that the engine passed to that
JS_TRUE if the native was defined with
new keyword, or from C/C++ using a JSAPI function such as
JS_ConstructObject. Otherwise it returns
JSNatives have no need to call this; it always returns
JS_FALSE for such functions.
Many constructors do not need to call it either. In the common case where a constructor should have the same behavior (creating a new object) whether it is called with the
new keyword or not, it does not need to call