Subj : distinguishing between constructor/function call To : netscape.public.mozilla.jseng From : Jason Date : Wed Feb 09 2005 08:08 am If I create a new object class Thingamajig using JS_InitClass, how can I distinguish between these syntaxes: (1) a = new Thingamajig() (2) b = Thingamajig() and what's the recommended action in general for (2)? My thought is to return null (safe) or make (2) behave like (1) by calling JS_NewObject(). Right now my object's constructor causes a crash in syntax (2) when it tries to call JS_SetPrivate(). I looked at jsdate.c which does this in the Date constructor: /* Date called as function */ if (!(cx->fp->flags & JSFRAME_CONSTRUCTING)) { but that's not a JSAPI call... .