mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-22 01:20:28 +02:00
* Add T(G|JS)Generator and Proxy classes. Closes !47
This commit is contained in:
parent
eb8e63aa30
commit
1f74abd200
@ -973,6 +973,28 @@ type
|
|||||||
Property Encoding : string Read FEncoding;
|
Property Encoding : string Read FEncoding;
|
||||||
end;
|
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
|
var
|
||||||
// JSArguments can be used in procedures/functions to provide access to the 'arguments' array.
|
// JSArguments can be used in procedures/functions to provide access to the 'arguments' array.
|
||||||
|
Loading…
Reference in New Issue
Block a user