Icon CreateObject

Unit: Internal

Available In: Client Applications

function CreateObject(const ObjectLiteral: String): <External Object Instance>

The CreateObject function creates an external object instance from a JavaScript object literal and returns it as the result. This function can be especially useful with JS APIs that require that you create object instances using object literals.

Information You must always cast the result of this function to the desired external class in order to be able to reference any properties or methods of the new external class instance from within Elevate Web Builder code.

Warning This function internaly uses the JavaScript eval function in order to create the object. Be very careful about passing object literal strings that have been derived from an external source to this function.

Examples

type
   external TMyExternalObject emit MyJSAPI.MyExternalObject = class
      public
         property Name: String read write;
      end;

var
   TempObject: TMyExternalObject;
begin
   TempObject := TMyExternalObject(CreateObject('{ Name: ''My External Object'' }'));
end
Image