SpiderMonkey JSAPI

JSAPI

The JSAPI is the C API for the SpiderMonkey JavaScript engine.

JS::Value / jsval

namespace JS { class Value; }
typedef JS::Value jsval;
  • Contain JavaScript values of any type

    • number

    • string

    • boolean

    • reference to object

      • Object

      • Array

      • Date

      • Function

      • null

      • undefined

  • JS::Value and jsval are the same type, jsval is the old name

JSClass

A JSClass acts as a vtable for JS objects that allows JSAPI clients to control various aspects of the behavior of an object like property lookup.

JSObject

  • The type of JavaScript objects in the JSAPI.

prototype

Most objects have a prototype. ( JS_GetPrototype )

  • An object inherits properties, including methods, from its prototype.

parent

Most objects have a parent. ( JS_GetParent )

own properties

A property of an object that is not inherited from its prototype.

Almost every object can have any number of its own properties.

Each property has a name, a getter, a setter, and property attributes. ( JS_GetPropertyAttributes )

Most properties also have a stored value.

Stored value

The stored value of an object property is its last known value.

  • JS_DefineProperty allows the application to specify a property's initial stored value.

  • JS_LookupProperty fetches a property's stored value without triggering its getter.

JSClass

Every object is associated with aJSClass.

JSString

Represents a primitive JavaScript string in the JSAPI.

An array of char16_t characters and a length.

JSNative

The type of many JSAPI callbacks.

Each JSNative has the same signature, regardless of what arguments it expects to receive from JavaScript.

Last updated

Was this helpful?