rtl: added JSDelete

This commit is contained in:
mattias 2018-06-14 13:54:31 +00:00
parent d8e91fc412
commit 8bda483894
3 changed files with 26 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
@ -20,9 +20,10 @@
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="1">
<Item1>
@ -45,6 +46,18 @@
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<AllowLabel Value="False"/>
<CPPInline Value="False"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
</Linking>
<Other>
<ExecuteBefore>
<Command Value="$MakeExe(pas2js) -Jirtl.js -Tnodejs -Fu$(ProjUnitPath) -o$NameOnly($(ProjFile)).js $Name($(ProjFile))"/>

View File

@ -1,6 +1,6 @@
program demodatetime;
uses sysutils;
uses sysutils, js;
Procedure DumpDate(Msg : String; Dt : TDateTime);

View File

@ -731,6 +731,7 @@ var
JSExceptValue: JSValue; external name '$e';
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 encodeURIComponent(str : String) : String; external name 'encodeURIComponent';
@ -780,7 +781,7 @@ Var
implementation
Function new(aElements: TJSValueDynArray) : TJSObject;
function new(aElements: TJSValueDynArray): TJSObject;
function toString(I : Integer): string; external name 'String';
@ -813,6 +814,11 @@ begin
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;
asm
if(v){ return true; } else { return false; };
@ -948,7 +954,7 @@ begin
end;
Function GetValueType(JS : JSValue) : TJSValueType;
function GetValueType(JS: JSValue): TJSValueType;
Var
t : string;