mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-09-13 05:59:09 +02:00
wasmjob: added some IJSJSON members
This commit is contained in:
parent
ed27e1411f
commit
32b763f134
@ -791,12 +791,26 @@ type
|
|||||||
|
|
||||||
IJSJSON = interface(IJSObject)
|
IJSJSON = interface(IJSObject)
|
||||||
['{73535059-91DD-4A22-91A6-D8072008C5F3}']
|
['{73535059-91DD-4A22-91A6-D8072008C5F3}']
|
||||||
|
function parse(const aJSON: UnicodeString): TJOB_JSValue; overload;
|
||||||
|
// Use this only when you are sure you will get an object, no checking is done.
|
||||||
|
function parseObject(const aJSON: UnicodeString): IJSObject; overload;
|
||||||
|
function stringify(aValue: TJOB_JSValue): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue; space: NativeInt): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue; const space: UnicodeString): UnicodeString; overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TJSJSON }
|
{ TJSJSON }
|
||||||
|
|
||||||
TJSJSON = class(TJSObject,IJSJSON)
|
TJSJSON = class(TJSObject,IJSJSON)
|
||||||
public
|
public
|
||||||
|
function parse(const aJSON: UnicodeString): TJOB_JSValue; overload;
|
||||||
|
// Use this only when you are sure you will get an object, no checking is done.
|
||||||
|
function parseObject(const aJSON: UnicodeString): IJSObject; overload;
|
||||||
|
function stringify(aValue: TJOB_JSValue): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue; space: NativeInt): UnicodeString; overload;
|
||||||
|
function stringify(aValue,aReplacer: TJOB_JSValue; const space: UnicodeString): UnicodeString; overload;
|
||||||
class function Cast(Intf: IJSObject): IJSJSON; overload;
|
class function Cast(Intf: IJSObject): IJSJSON; overload;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1114,6 +1128,38 @@ end;
|
|||||||
|
|
||||||
{ TJSJSON }
|
{ TJSJSON }
|
||||||
|
|
||||||
|
function TJSJSON.parse(const aJSON: UnicodeString): TJOB_JSValue;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSValueResult('parse',[aJSON]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJSJSON.parseObject(const aJSON: UnicodeString): IJSObject;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSObjectResult('parse',[aJSON],TJSObject) as IJSObject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJSJSON.stringify(aValue: TJOB_JSValue): UnicodeString;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSUnicodeStringResult('stringify',[aValue]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJSJSON.stringify(aValue, aReplacer: TJOB_JSValue): UnicodeString;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSUnicodeStringResult('stringify',[aValue,aReplacer]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJSJSON.stringify(aValue, aReplacer: TJOB_JSValue; space: NativeInt
|
||||||
|
): UnicodeString;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSUnicodeStringResult('stringify',[aValue,aReplacer,space]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJSJSON.stringify(aValue, aReplacer: TJOB_JSValue;
|
||||||
|
const space: UnicodeString): UnicodeString;
|
||||||
|
begin
|
||||||
|
Result:=InvokeJSUnicodeStringResult('stringify',[aValue,aReplacer,space]);
|
||||||
|
end;
|
||||||
|
|
||||||
class function TJSJSON.Cast(Intf: IJSObject): IJSJSON;
|
class function TJSJSON.Cast(Intf: IJSObject): IJSJSON;
|
||||||
begin
|
begin
|
||||||
Result:=TJSJSON.Cast(Intf);
|
Result:=TJSJSON.Cast(Intf);
|
||||||
|
Loading…
Reference in New Issue
Block a user