Module SpiderCaml


module SpiderCaml: sig .. end
Binding to SpiderMonkey's implementation of Javascript.


Author: Alain Frisch.

It is possible to manage several runtimes at the same time. Each runtime is implicitly bound to an object created by a call to new_global_obj. All the values created from this object (directly or not) are also attached to this runtime.

It is not legal to mix values from several runtimes (e.g. to set the value of a property of an object A to a value B, where A and B are in different runtimes). The exception InvalidRuntime is raised when this rule is broken.

In order to avoid memory leaks, it is necessary to call the destroy_runtime on an arbitrary value of the runtime. After this call, it is illegal to use values from this runtime (actually, only calling closures and registering new ones is prohibited). An exception RuntimeDestroyed is raised when this rule is broken.

type jsval 
Internal use.

type 'a active = {
   setter : string -> 'a -> 'a;
   getter : string -> 'a -> 'a;
}
Active objects can intercept access to their properties.

The setter function is called when a property is written. The first argument is the property name and the second argument is the new value for the property. The function can perform arbitrary side effects and choose another value for the property.

Similarly, the getter function is called when a property is read. The second argument is the current value for the property and the result is the actual value returned for the read operation.

class type jsobj = object .. end
Encapsulation of Javascript values.
val new_global_obj : ?active:jsobj active -> unit -> jsobj
Create a new global object.
val implementation_version : unit -> string
module Error: sig .. end