Delphi
| projects: | Home Articles JavaScript Bridge |
|---|---|
| resources: | Bugs Mailing List Source Code Sidebar |
Bridge Classes: TJSBridge
Native Delphi / Kylix classes can inherit from this base type to become seamlessly available to
JavaScript. All that is required is an instance of TJSEngine and a name, passed to the
constructor. If you do not want to connect to JavaScript at creation time, simply pass the TJSEngine
instance and name to the Connect method whenever it is convenient to do so.
Properties
- _FConnected: Boolean
When true the object is connected to an instance ofTJSEngine, permitting interaction with script code. - _FContext: PJSContext
Only advanced developers should use this property. It can be used with SpiderMonkey API calls. - _FEngine: TJSEngine
Use this property to access the engine to which theTJSBridgeis connected. - _FParent: TJSObject
Accesses the parent JavaScript object containing the bridge instance. - _FJSObject: PJSObject
Only advanced developers should use this property. It can be used with SpiderMonkey API calls.
Methods
- function Connect(AEngine: TJSEngine; const AInstanceName: string): Boolean;
Connects the bridge object to theTJSEngineinstance. The bridge is attached to the global JavaScript object. - function Connect(AEngine: TJSEngine; const AInstanceName: string; AParent: TJSObject): Boolean;
Connects the bridge object to theTJSEngineinstance. The bridge is attached to the specified parent JavaScript object. - constructor Create; overload; virtual;
Creates a default, disconnected instance of a bridge object. - constructor Create(AEngine: TJSEngine; const AInstanceName: string); overload; virtual;
Creates a connected bridge object, and attaches it to the global JavaScript scope. - constructor Create(AEngine: TJSEngine; AParent: TJSObject; const AInstanceName: string); overload; virtual;
Creates a connected bridge object, and attaches it to the specified parent JavaScript object. - procedure Disconnect;
Disconnects the object from the live JavaScript connection. A new connection can be made at any time following a disconnection. - function GetProperty(AName: PChar): jsval;
Developers should not use this method. It is used by SpiderMonkey callback routines injsbridge_pvt.pas. - function SetProperty(AName, AValue: PChar): JSBool;
Developers should not use this method. It is used by SpiderMonkey callback routines injsbridge_pvt.pas.