* Add T(G|JS)Generator and Proxy classes. Closes !47

This commit is contained in:
Michaël Van Canneyt 2023-12-13 15:38:40 +01:00
parent eb8e63aa30
commit 1f74abd200

View File

@ -973,6 +973,28 @@ type
Property Encoding : string Read FEncoding;
end;
generic TGGenerator<T> = class external name 'Generator' (TJSObject)
private type
TGGeneratorValue = class external name 'Generator' (TJSObject)
public
done: Boolean;
value: T;
end;
public
function next: TGGeneratorValue; overload;
function next(Value: T): TGGeneratorValue; overload;
function return: TGGeneratorValue; overload;
function return(Value: T): TGGeneratorValue; overload;
function throw(Error: TJSError): TGGeneratorValue;
end;
TJSGenerator = specialize TGGenerator<JSValue>;
TJSProxy = class external name 'Proxy' (TJSObject)
public
constructor New(Target, Handler: TJSObject);
end;
var
// JSArguments can be used in procedures/functions to provide access to the 'arguments' array.