mozdev.org

Delphi 

projects:
resources:
<- Back

Bridge Classes: TJSFunction

An object of this class wraps a JavaScript function which was added via TJSObject.AddMethod. This object currently cannot be retrieved dynamically from the bridge APIs, though the JavaScript function remains declared. We hope to have this fixed soon.

Properties
  • Connected: Boolean

    When true the object is connected to an instance of TJSEngine, permitting interaction with script code.
  • Destroying: Boolean

    Developers should not need to access this property. It is used when an instance of TJSEngine is shut down.
  • Engine: TJSEngine

    Use this property to access the engine to which the TJSFunction is connected.
  • JScriptVal: jsval

    Only advanced developers should use this property. It can be used in SpiderMonkey callback functions, or API calls, for instance.
  • JSName: string

    This is the name associated with the variable in JavaScript.
  • JSObject: PJSObject

    Only advanced users should use this property. A developer can use this value when working with the SpiderMonkey API.
  • Parent: TJSObject

    The parent is the scope from which the current TJSFunction is accessible. If no parent was assigned when the TJSFunction was created it will default to TJSEngine.Global.
Methods
  • constructor Create(AValue: PJSObject; AEngine: TJSEngine; const AName: string);

    Developers should not create instances of TJSFunction at this time.
  • constructor Create(AValue: PJSObject; AEngine: TJSEngine; const AName: string; AParent: TJSObject);

    Developers should not create instances of TJSFunction at this time.
  • function Call(params: array of TJSBase; var str: string): Boolean;
    function Call(params: array of TJSBase; var int: Integer): Boolean;
    function Call(params: array of TJSBase; var dbl: Double): Boolean;
    function Call(params: array of TJSBase; var res: TJSObject): Boolean;
    function Call(params: array of TJSBase; var bool: Boolean): Boolean;

    These methods call the JavaScript function wrapped by this object with parameters params, and attempts to return a value into the second parameter. If the method returns false the call, or the return value conversion, failed.
  • function Call(var str: string): Boolean;
    function Call(var int: Integer): Boolean;
    function Call(var dbl: Double): Boolean;
    function Call(var res: TJSObject): Boolean;
    function Call(var bool: Boolean): Boolean;

    These methods call the JavaScript function wrapped by this object with no parameters, and attempts to return a value into the given parameter. If the method returns false the call, or the return value conversion, failed.
  • procedure Connect(AEngine: TJSEngine; AName: string; AParent: TJSObject);
    procedure Connect(AEngine: TJSEngine; AName: string);

    Connects the TJSFunction to the engine. The first declaration will assign the JavaScript object to the specified scope, while the second will default the scope to global.

The delphi project can be contacted through the mailing list or the member list.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.