mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-18 15:39:05 +02:00
rtl: added JSDelete
This commit is contained in:
parent
d8e91fc412
commit
8bda483894
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="11"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
@ -20,9 +20,10 @@
|
|||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<FormatVersion Value="2"/>
|
||||||
<FormatVersion Value="1"/>
|
<Modes Count="1">
|
||||||
</local>
|
<Mode0 Name="default"/>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="1">
|
<RequiredPackages Count="1">
|
||||||
<Item1>
|
<Item1>
|
||||||
@ -45,6 +46,18 @@
|
|||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<AllowLabel Value="False"/>
|
||||||
|
<CPPInline Value="False"/>
|
||||||
|
<UseAnsiStrings Value="False"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
<ExecuteBefore>
|
<ExecuteBefore>
|
||||||
<Command Value="$MakeExe(pas2js) -Jirtl.js -Tnodejs -Fu$(ProjUnitPath) -o$NameOnly($(ProjFile)).js $Name($(ProjFile))"/>
|
<Command Value="$MakeExe(pas2js) -Jirtl.js -Tnodejs -Fu$(ProjUnitPath) -o$NameOnly($(ProjFile)).js $Name($(ProjFile))"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
program demodatetime;
|
program demodatetime;
|
||||||
|
|
||||||
uses sysutils;
|
uses sysutils, js;
|
||||||
|
|
||||||
Procedure DumpDate(Msg : String; Dt : TDateTime);
|
Procedure DumpDate(Msg : String; Dt : TDateTime);
|
||||||
|
|
||||||
|
@ -731,6 +731,7 @@ var
|
|||||||
JSExceptValue: JSValue; external name '$e';
|
JSExceptValue: JSValue; external name '$e';
|
||||||
|
|
||||||
Function new(aElements: TJSValueDynArray) : TJSObject; overload;
|
Function new(aElements: TJSValueDynArray) : TJSObject; overload;
|
||||||
|
function JSDelete(const Obj: JSValue; const PropName: string): boolean; assembler; overload;
|
||||||
|
|
||||||
function decodeURIComponent(encodedURI : String) : String; external name 'decodeURIComponent';
|
function decodeURIComponent(encodedURI : String) : String; external name 'decodeURIComponent';
|
||||||
function encodeURIComponent(str : String) : String; external name 'encodeURIComponent';
|
function encodeURIComponent(str : String) : String; external name 'encodeURIComponent';
|
||||||
@ -780,7 +781,7 @@ Var
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
Function new(aElements: TJSValueDynArray) : TJSObject;
|
function new(aElements: TJSValueDynArray): TJSObject;
|
||||||
|
|
||||||
function toString(I : Integer): string; external name 'String';
|
function toString(I : Integer): string; external name 'String';
|
||||||
|
|
||||||
@ -813,6 +814,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function JSDelete(const Obj: JSValue; const PropName: string): boolean; assembler;
|
||||||
|
asm
|
||||||
|
return delete Obj[PropName];
|
||||||
|
end;
|
||||||
|
|
||||||
function hasValue(const v: JSValue): boolean; assembler;
|
function hasValue(const v: JSValue): boolean; assembler;
|
||||||
asm
|
asm
|
||||||
if(v){ return true; } else { return false; };
|
if(v){ return true; } else { return false; };
|
||||||
@ -948,7 +954,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function GetValueType(JS : JSValue) : TJSValueType;
|
function GetValueType(JS: JSValue): TJSValueType;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
t : string;
|
t : string;
|
||||||
|
Loading…
Reference in New Issue
Block a user