* Some fixes based on remarks of Jerome

This commit is contained in:
Michaël Van Canneyt 2022-05-24 17:44:37 +02:00
parent 777b6dd3ad
commit fc23ed5458
2 changed files with 59 additions and 54 deletions

View File

@ -46,7 +46,6 @@ Type
TJSFileSystemDirectoryHandleArray = array of TJSFileSystemDirectoryHandle; TJSFileSystemDirectoryHandleArray = array of TJSFileSystemDirectoryHandle;
TJSShowOpenFilePickerOptions = class; TJSShowOpenFilePickerOptions = class;
TJSShowSaveFilePickerOptions = class; TJSShowSaveFilePickerOptions = class;
TJSClient = class;
TJSServiceWorker = weborworker.TJSServiceWorker; TJSServiceWorker = weborworker.TJSServiceWorker;
TJSServiceWorkerRegistration = weborworker.TJSServiceWorkerRegistration; TJSServiceWorkerRegistration = weborworker.TJSServiceWorkerRegistration;
@ -202,6 +201,7 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
constructor New; constructor New;
{$ENDIF} {$ENDIF}
end; end;
TJSClientRect = record TJSClientRect = record
left,top,right,bottom : double; left,top,right,bottom : double;
{$IFDEF FIREFOX} {$IFDEF FIREFOX}
@ -1155,14 +1155,6 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
TJSWorker = weborworker.TJSWorker; TJSWorker = weborworker.TJSWorker;
TJSMessagePort = class external name 'MessagePort' (TJSEventTarget)
Public
procedure close;
procedure postMessage(aValue : JSValue);
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
procedure start;
end;
TJSMessagePortDynArray = Array of TJSMessagePort;
{ TJSSharedWorker } { TJSSharedWorker }
@ -1176,50 +1168,8 @@ TEventListenerEvent = class external name 'EventListener_Event' (TJSObject)
end; end;
TJSExtendableEvent = weborworker.TJSExtendableEvent; TJSExtendableEvent = weborworker.TJSExtendableEvent;
TJSClient = weborworker.TJSClient;
{ TJSExtendableMessageEvent } TJSExtendableMessageEvent = weborworker.TJSExtendableMessageEvent;
TJSExtendableMessageEvent = class external name 'ExtendableMessageEvent' (TJSExtendableEvent)
private
FData: JSValue; external name 'data';
FLastEventID: String; external name 'lastEventId';
FOrigin: String; external name 'origin';
FPorts: TJSMessagePortDynArray; external name 'ports';
FSource: TJSObject; external name 'source';
FSourceClient: TJSClient; external name 'source';
FSourcePort: TJSMessagePort; external name 'source';
FSourceServiceWorker: TJSServiceWorker; external name 'source';
Public
Property Data : JSValue Read FData;
Property LastEventID : String Read FLastEventID;
Property Origin : String Read FOrigin;
Property Ports : TJSMessagePortDynArray Read FPorts;
Property Source : TJSObject Read FSource;
// Possible types for Source
Property SourceServiceWorker : TJSServiceWorker Read FSourceServiceWorker;
Property SourcePort : TJSMessagePort Read FSourcePort;
Property SourceClient : TJSClient Read FSourceClient;
end;
{ TJSClient }
TJSClient = class external name 'Client' (TJSObject)
private
FFrameType: String; external name 'frameType';
FID: String; external name 'id';
FType: String; external name 'type';
FURL: String; external name 'url';
Public
procedure postMessage(aValue : JSValue);
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
Property Id : String Read FID;
Property Type_ : String Read FType;
Property FrameType : String Read FFrameType;
Property URL : String Read FURL;
end;
TJSServiceWorkerContainerOptions = record TJSServiceWorkerContainerOptions = record
scope : string; scope : string;

View File

@ -19,6 +19,7 @@ type
TJSIDBRequest = class; TJSIDBRequest = class;
TJSServiceWorker = class; TJSServiceWorker = class;
TJSReadableStream = class; TJSReadableStream = class;
TJSClient = class;
{ ---------------------------------------------------------------------- { ----------------------------------------------------------------------
Console Console
@ -105,6 +106,7 @@ type
Procedure waitUntil(aPromise : TJSPromise); Procedure waitUntil(aPromise : TJSPromise);
end; end;
TJSEventHandler = reference to function(Event: TJSEvent): boolean; safecall; TJSEventHandler = reference to function(Event: TJSEvent): boolean; safecall;
TJSRawEventHandler = reference to Procedure(Event: TJSEvent); safecall; TJSRawEventHandler = reference to Procedure(Event: TJSEvent); safecall;
@ -120,6 +122,58 @@ type
end; end;
TJSMessagePort = class external name 'MessagePort' (TJSEventTarget)
Public
procedure close;
procedure postMessage(aValue : JSValue);
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
procedure start;
end;
TJSMessagePortDynArray = Array of TJSMessagePort;
{ TJSExtendableMessageEvent }
TJSExtendableMessageEvent = class external name 'ExtendableMessageEvent' (TJSExtendableEvent)
private
FData: JSValue; external name 'data';
FLastEventID: String; external name 'lastEventId';
FOrigin: String; external name 'origin';
FPorts: TJSMessagePortDynArray; external name 'ports';
FSource: TJSObject; external name 'source';
FSourceClient: TJSClient; external name 'source';
FSourcePort: TJSMessagePort; external name 'source';
FSourceServiceWorker: TJSServiceWorker; external name 'source';
Public
Property Data : JSValue Read FData;
Property LastEventID : String Read FLastEventID;
Property Origin : String Read FOrigin;
Property Ports : TJSMessagePortDynArray Read FPorts;
Property Source : TJSObject Read FSource;
// Possible types for Source
Property SourceServiceWorker : TJSServiceWorker Read FSourceServiceWorker;
Property SourcePort : TJSMessagePort Read FSourcePort;
Property SourceClient : TJSClient Read FSourceClient;
end;
{ TJSClient }
TJSClient = class external name 'Client' (TJSObject)
private
FFrameType: String; external name 'frameType';
FID: String; external name 'id';
FType: String; external name 'type';
FURL: String; external name 'url';
Public
procedure postMessage(aValue : JSValue);
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
Property Id : String Read FID;
Property Type_ : String Read FType;
Property FrameType : String Read FFrameType;
Property URL : String Read FURL;
end;
{ ---------------------------------------------------------------------- { ----------------------------------------------------------------------
Fetch & Streams Fetch & Streams
----------------------------------------------------------------------} ----------------------------------------------------------------------}
@ -1011,7 +1065,7 @@ type
Private Private
FCrypto: TJSCrypto; external name 'crypto'; FCrypto: TJSCrypto; external name 'crypto';
FisSecureContext : boolean; external name 'isSecureContext'; FisSecureContext : boolean; external name 'isSecureContext';
FIDBFactory : TJSIDBFactory; external name 'IDBFactory'; FIDBFactory : TJSIDBFactory; external name 'indexedDB';
fcaches : TJSCacheStorage; external name 'caches'; fcaches : TJSCacheStorage; external name 'caches';
Public Public
Function setInterval(ahandler : TJSTimerCallBack; aInterval : NativeUInt) : NativeInt; varargs; Function setInterval(ahandler : TJSTimerCallBack; aInterval : NativeUInt) : NativeInt; varargs;
@ -1040,6 +1094,7 @@ type
var var
Console : TJSConsole; external name 'console'; Console : TJSConsole; external name 'console';
Crypto: TJSCrypto; external name 'crypto'; Crypto: TJSCrypto; external name 'crypto';
indexedDB : TJSIDBFactory; external name 'indexedDB';
function fetch(resource: String; init: TJSObject): TJSPromise; overload; external name 'fetch'; function fetch(resource: String; init: TJSObject): TJSPromise; overload; external name 'fetch';
//function fetch(resource: String): TJSPromise; overload; external name 'fetch'; //function fetch(resource: String): TJSPromise; overload; external name 'fetch';