mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-05 00:47:47 +02:00
* Proper split
This commit is contained in:
parent
e9a258cc8e
commit
f7b65b4ca0
3
packages/rtl/namespaced/BrowserApi.ServiceWorker.pas
Normal file
3
packages/rtl/namespaced/BrowserApi.ServiceWorker.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit BrowserApi.ServiceWorker;
|
||||
{$include ../src/serviceworker.pas}
|
3
packages/rtl/namespaced/BrowserApi.SharedWorker.pas
Normal file
3
packages/rtl/namespaced/BrowserApi.SharedWorker.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit BrowserApi.SharedWorker;
|
||||
{$include ../src/sharedworker.pas}
|
3
packages/rtl/namespaced/BrowserApi.WorkerBase.pas
Normal file
3
packages/rtl/namespaced/BrowserApi.WorkerBase.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit BrowserApi.WorkerBase;
|
||||
{$include ../src/webworkerbase.pas}
|
60
packages/rtl/src/serviceworker.pas
Normal file
60
packages/rtl/src/serviceworker.pas
Normal file
@ -0,0 +1,60 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit serviceworker;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
{$modeswitch externalclass}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.WorkerBase;
|
||||
{$ELSE}
|
||||
js, weborworker, webworkerbase;
|
||||
{$Endif}
|
||||
|
||||
Type
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
TJSWorkerNavigator = BrowserApi.WorkerBase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = BrowserApi.WorkerBase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = BrowserApi.WorkerBase.TJSWorkerGlobalScope;
|
||||
{$ELSE}
|
||||
TJSWorkerNavigator = webworkerbase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = webworkerbase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = webworkerbase.TJSWorkerGlobalScope;
|
||||
{$ENDIF}
|
||||
|
||||
{ TJSServiceworkerGlobalScope }
|
||||
|
||||
TJSClientsMatchAllOptions = class external name 'Object'
|
||||
includeUncontrolled : Boolean;
|
||||
type_ : string; external name 'type';
|
||||
end;
|
||||
|
||||
TJSClients = class external name 'Clients' (TJSObject)
|
||||
function claim : TJSPromise;
|
||||
function get(ID : String) : TJSPromise;
|
||||
function matchAll : TJSPromise;
|
||||
function matchAll(Options : TJSClientsMatchAllOptions) : TJSPromise;
|
||||
function matchAll(Options : TJSObject) : TJSPromise;
|
||||
function openWindow(url : string) : TJSPromise;
|
||||
end;
|
||||
|
||||
TJSServiceworkerGlobalScope = class external name 'ServiceWorkerGlobalScope' (TJSWorkerGlobalScope)
|
||||
private
|
||||
FClients: TJSClients; external name 'clients';
|
||||
FRegistration: TJSServiceWorkerRegistration; external name 'registration';
|
||||
Public
|
||||
Function SkipWaiting : TJSPromise; external name 'skipWaiting';
|
||||
property registration : TJSServiceWorkerRegistration Read FRegistration;
|
||||
property clients : TJSClients Read FClients;
|
||||
end;
|
||||
|
||||
var
|
||||
Self_ : TJSServiceworkerGlobalScope; external name 'self';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
44
packages/rtl/src/sharedworker.pas
Normal file
44
packages/rtl/src/sharedworker.pas
Normal file
@ -0,0 +1,44 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit sharedworker;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
{$modeswitch externalclass}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.WorkerBase;
|
||||
{$ELSE}
|
||||
js, weborworker, webworkerbase;
|
||||
{$Endif}
|
||||
|
||||
Type
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
TJSWorkerNavigator = BrowserApi.WebWorkerBase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = BrowserApi.WebWorkerBase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = BrowserApi.WebWorkerBase.TJSWorkerGlobalScope;
|
||||
{$ELSE}
|
||||
TJSWorkerNavigator = webworkerbase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = webworkerbase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = webworkerbase.TJSWorkerGlobalScope;
|
||||
{$ENDIF}
|
||||
{ TJSServiceworkerGlobalScope }
|
||||
|
||||
TJSSharedWorkerGlobalScope = class external name 'SharedWorkerGlobalScope' (TJSWorkerGlobalScope)
|
||||
private
|
||||
FName : String; external name 'name';
|
||||
Public
|
||||
procedure close;
|
||||
property name : string Read FName;
|
||||
end;
|
||||
|
||||
var
|
||||
Self_ : TJSSharedWorkerGlobalScope; external name 'self';
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -1603,16 +1603,6 @@ type
|
||||
Property action : String Read Faction;
|
||||
end;
|
||||
|
||||
{ --------------------------------------------------------------------
|
||||
TJSServiceWorkerGlobalScope
|
||||
--------------------------------------------------------------------}
|
||||
|
||||
TJSServiceWorkerGlobalScope = class external name 'ServiceWorkerGlobalScope'
|
||||
Private
|
||||
Public
|
||||
onnotificationclick : TJSEventHandler;
|
||||
onnotificationclose : TJSEventHandler;
|
||||
end;
|
||||
|
||||
TCanvasCoordType = double;
|
||||
{ TJSImageData }
|
||||
|
@ -23,113 +23,41 @@ interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
JSApi.JS, BrowserApi.WebOrWorker;
|
||||
JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.WorkerBase;
|
||||
{$ELSE}
|
||||
JS, weborworker;
|
||||
JS, weborworker, webworkerbase;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
|
||||
{ TJSWorkerNavigator }
|
||||
|
||||
TJSWorkerNavigator = class external name 'WorkerNavigator' (TJSObject)
|
||||
private
|
||||
FhardwareConcurrency: Integer; external name 'hardwareConcurrency';
|
||||
FLanguage: String; external name 'language';
|
||||
FLanguages: TJSStringDynArray; external name 'languages';
|
||||
FOnline: boolean; external name 'onLine';
|
||||
FPlatform: string; external name 'platform';
|
||||
FUserAgent: string; external name 'userAgent';
|
||||
public
|
||||
property language : String read FLanguage;
|
||||
property languages : TJSStringDynArray read FLanguages;
|
||||
property onLine : boolean read FOnline;
|
||||
property platform : string read FPlatform;
|
||||
property userAgent : string read FUserAgent;
|
||||
property hardwareConcurrency : Integer Read FhardwareConcurrency;
|
||||
end;
|
||||
|
||||
{ TJSWorkerLocation }
|
||||
|
||||
TJSWorkerLocation = class external name 'WorkerLocation' (TJSObject)
|
||||
Private
|
||||
FHash: string;external name 'hash';
|
||||
FHost: string;external name 'host';
|
||||
FHostName: string;external name 'hostname';
|
||||
FHRef: string; external name 'href';
|
||||
FOrigin : string; external name 'origin';
|
||||
FPathName: string;external name 'pathname';
|
||||
FPort: string;external name 'port';
|
||||
FProtocol: string;external name 'protocol';
|
||||
FSearch: string;external name 'search';
|
||||
Public
|
||||
Property hash : string Read FHash;
|
||||
Property host : string read FHost;
|
||||
Property hostname : string read FHostName;
|
||||
Property href : string read FHRef;
|
||||
Property pathname : string Read FPathName;
|
||||
Property port : string Read FPort;
|
||||
Property protocol : string Read FProtocol;
|
||||
Property search : string read FSearch;
|
||||
property origin : string read FOrigin;
|
||||
end;
|
||||
|
||||
{ TJSWorkerGlobalScope }
|
||||
|
||||
TJSWorkerGlobalScope = class external name 'WorkerGlobalScope' (TWindowOrWorkerGlobalScope)
|
||||
private
|
||||
FConsole: TJSConsole; external name 'console';
|
||||
FLocation: TJSWorkerLocation; external name 'location';
|
||||
FNavigator: TJSWorkerNavigator; external name 'navigator';
|
||||
FSelf : TJSWorkerGlobalScope external name 'self';
|
||||
Public
|
||||
procedure importScripts(path : string); varargs;
|
||||
property Navigator: TJSWorkerNavigator read FNavigator;
|
||||
property console : TJSConsole Read FConsole;
|
||||
property location : TJSWorkerLocation Read FLocation;
|
||||
Property Self_ : TJSWorkerGlobalScope Read FSelf;
|
||||
end;
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
TJSWorkerNavigator = BrowserApi.WorkerBase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = BrowserApi.WorkerBase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = BrowserApi.WorkerBase.TJSWorkerGlobalScope;
|
||||
{$ELSE}
|
||||
TJSWorkerNavigator = webworkerbase.TJSWorkerNavigator;
|
||||
TJSWorkerLocation = webworkerbase.TJSWorkerLocation;
|
||||
TJSWorkerGlobalScope = webworkerbase.TJSWorkerGlobalScope;
|
||||
{$ENDIF}
|
||||
|
||||
{ TJSDedicatedWorkerGlobalScope }
|
||||
TJSAnimationFrameCallBack = reference to procedure(aTimeStamp : TJSDOMHighResTimeStamp);
|
||||
|
||||
TJSDedicatedWorkerGlobalScope = class external name 'DedicatedWorkerGlobalScope' (TJSWorkerGlobalScope)
|
||||
private
|
||||
FName: String; external name 'name';
|
||||
Public
|
||||
Procedure cancelAnimationFrame(handle : NativeInt);
|
||||
Procedure close;
|
||||
Procedure postMessage(aMessage : JSValue); overload;
|
||||
Procedure postMessage(aMessage : JSValue; TransferableObjects : Array of JSValue); overload;
|
||||
function RequestAnimationFrame(aCallback : TJSAnimationFrameCallBack) : NativeInt;
|
||||
Property name : String Read FName;
|
||||
end;
|
||||
|
||||
TJSClientsMatchAllOptions = class external name 'Object'
|
||||
includeUncontrolled : Boolean;
|
||||
type_ : string; external name 'type';
|
||||
end;
|
||||
|
||||
TJSClients = class external name 'Clients' (TJSObject)
|
||||
function claim : TJSPromise;
|
||||
function get(ID : String) : TJSPromise;
|
||||
function matchAll : TJSPromise;
|
||||
function matchAll(Options : TJSClientsMatchAllOptions) : TJSPromise;
|
||||
function matchAll(Options : TJSObject) : TJSPromise;
|
||||
function openWindow(url : string) : TJSPromise;
|
||||
end;
|
||||
|
||||
{ TJSServiceworkerGlobalScope }
|
||||
|
||||
TJSServiceworkerGlobalScope = class external name 'ServiceWorkerGlobalScope' (TJSWorkerGlobalScope)
|
||||
private
|
||||
FClients: TJSClients; external name 'clients';
|
||||
FRegistration: TJSServiceWorkerRegistration; external name 'registration';
|
||||
Public
|
||||
Function SkipWaiting : TJSPromise; external name 'skipWaiting';
|
||||
property registration : TJSServiceWorkerRegistration Read FRegistration;
|
||||
property clients : TJSClients Read FClients;
|
||||
end;
|
||||
|
||||
Var
|
||||
Self_ : TJSServiceWorkerGlobalScope; external name 'self';
|
||||
Self_ : TJSDedicatedWorkerGlobalScope; external name 'self';
|
||||
location : TJSWorkerLocation ; external name 'location';
|
||||
console : TJSConsole; external name 'console';
|
||||
navigator : TJSWorkerNavigator; external name 'navigator';
|
||||
|
Loading…
Reference in New Issue
Block a user