@live-codes/pascal-wasm 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +501 -0
- package/README.md +278 -0
- package/THIRD-PARTY-NOTICES.md +48 -0
- package/assets/pas2js.wasm +0 -0
- package/assets/rtl/Rtl.BrowserLoadHelper.pas +179 -0
- package/assets/rtl/browserconsole.pas +190 -0
- package/assets/rtl/classes.pas +11371 -0
- package/assets/rtl/js.pas +2211 -0
- package/assets/rtl/manifest.json +19 -0
- package/assets/rtl/math.pas +903 -0
- package/assets/rtl/p2jsres.pp +334 -0
- package/assets/rtl/rtl.js +1563 -0
- package/assets/rtl/rtlconsts.pas +97 -0
- package/assets/rtl/simplelinkedlist.pas +152 -0
- package/assets/rtl/system.pas +1166 -0
- package/assets/rtl/sysutils.pas +8959 -0
- package/assets/rtl/types.pas +2296 -0
- package/assets/rtl/typinfo.pas +1680 -0
- package/assets/rtl/web.pas +3586 -0
- package/assets/rtl/weborworker.pas +2101 -0
- package/dist/pascal-wasm.iife.min.js +6 -0
- package/dist/pascal-wasm.iife.min.js.map +7 -0
- package/package.json +54 -0
- package/src/assets.js +119 -0
- package/src/compiler.js +142 -0
- package/src/config.js +24 -0
- package/src/iife.js +27 -0
- package/src/index.js +130 -0
- package/src/vendor/browser_wasi_shim/debug.js +1 -0
- package/src/vendor/browser_wasi_shim/fd.js +1 -0
- package/src/vendor/browser_wasi_shim/fs_mem.js +1 -0
- package/src/vendor/browser_wasi_shim/fs_opfs.js +1 -0
- package/src/vendor/browser_wasi_shim/index.js +1 -0
- package/src/vendor/browser_wasi_shim/strace.js +1 -0
- package/src/vendor/browser_wasi_shim/wasi.js +1 -0
- package/src/vendor/browser_wasi_shim/wasi_defs.js +1 -0
- package/types/index.d.ts +89 -0
|
@@ -0,0 +1,2101 @@
|
|
|
1
|
+
{
|
|
2
|
+
This file is part of the Pas2JS run time library.
|
|
3
|
+
Copyright (c) 2022 by Michael Van Canneyt
|
|
4
|
+
|
|
5
|
+
Browser Worker and Window API definitions
|
|
6
|
+
|
|
7
|
+
See the file COPYING.FPC, included in this distribution,
|
|
8
|
+
for details about the copyright.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
|
|
14
|
+
**********************************************************************}
|
|
15
|
+
|
|
16
|
+
{$IFNDEF FPC_DOTTEDUNITS}
|
|
17
|
+
unit weborworker;
|
|
18
|
+
{$ENDIF}
|
|
19
|
+
|
|
20
|
+
{$mode objfpc}
|
|
21
|
+
{$modeswitch externalclass}
|
|
22
|
+
|
|
23
|
+
interface
|
|
24
|
+
|
|
25
|
+
uses
|
|
26
|
+
{$IFDEF FPC_DOTTEDUNITS}
|
|
27
|
+
JSApi.JS, System.Types;
|
|
28
|
+
{$ELSE}
|
|
29
|
+
JS, types;
|
|
30
|
+
{$ENDIF}
|
|
31
|
+
|
|
32
|
+
type
|
|
33
|
+
// Forward declarations
|
|
34
|
+
|
|
35
|
+
TJSCryptoKey = Class;
|
|
36
|
+
TJSSubtleCrypto = Class;
|
|
37
|
+
TJSEventTarget = class;
|
|
38
|
+
TIDBDatabase = class;
|
|
39
|
+
TJSIDBObjectStore = class;
|
|
40
|
+
TJSIDBRequest = class;
|
|
41
|
+
TJSServiceWorker = class;
|
|
42
|
+
TJSReadableStream = class;
|
|
43
|
+
TJSClient = class;
|
|
44
|
+
TJSFileSystemHandle = class;
|
|
45
|
+
TJSFileSystemFileHandle = class;
|
|
46
|
+
TJSFileSystemDirectoryHandle = class;
|
|
47
|
+
TJSFileSystemWritableFileStream = class;
|
|
48
|
+
TJSFileSystemSyncAccessHandle = class;
|
|
49
|
+
TFileSystemHandleKind = String;
|
|
50
|
+
TWriteCommandType = String;
|
|
51
|
+
TJSNotification = Class;
|
|
52
|
+
TJSNotificationEvent = Class;
|
|
53
|
+
TJSNotificationOptions = Class;
|
|
54
|
+
TJSNotificationAction = Class;
|
|
55
|
+
TJSGetNotificationOptions = Class;
|
|
56
|
+
TJSNotificationEventInit = Class;
|
|
57
|
+
TJSAbortSignal = class;
|
|
58
|
+
NotificationPermission = String;
|
|
59
|
+
NotificationDirection = String;
|
|
60
|
+
NotificationPermissionCallback = Procedure (permission : NotificationPermission);
|
|
61
|
+
TJSHTMLOffscreenCanvas = class;
|
|
62
|
+
TJSOffscreenCanvasRenderingContext2D = class;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
TJSFileSystemFileHandleArray = array of TJSFileSystemFileHandle;
|
|
66
|
+
TJSFileSystemDirectoryHandleArray = array of TJSFileSystemDirectoryHandle;
|
|
67
|
+
|
|
68
|
+
TJSVibratePattern = JSValue;
|
|
69
|
+
|
|
70
|
+
{ ----------------------------------------------------------------------
|
|
71
|
+
Console
|
|
72
|
+
----------------------------------------------------------------------}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
TJSConsole = class external name 'Console' (TJSObject)
|
|
76
|
+
Public
|
|
77
|
+
procedure assert(anAssertion : string; Obj1 : JSValue); varargs;
|
|
78
|
+
Procedure clear;
|
|
79
|
+
procedure count; overload;
|
|
80
|
+
procedure count(aCounter : String);
|
|
81
|
+
procedure debug(Obj1 : JSValue); varargs of JSValue;
|
|
82
|
+
procedure error(Obj1 : JSValue); varargs of JSValue;
|
|
83
|
+
procedure group; overload;
|
|
84
|
+
procedure group(aLabel : String); overload;
|
|
85
|
+
procedure groupCollapsed; overload;
|
|
86
|
+
procedure groupCollapsed(aLabel : String);overload;
|
|
87
|
+
procedure groupEnd;
|
|
88
|
+
procedure info(Obj1 : JSValue); varargs of JSValue;
|
|
89
|
+
procedure log(Obj1 : JSValue); varargs of JSValue;
|
|
90
|
+
procedure table(args: array of JSValue); overload;
|
|
91
|
+
procedure table(args: array of JSValue; Columns : Array of string);
|
|
92
|
+
procedure table(args: TJSObject); overload;
|
|
93
|
+
procedure table(args: TJSObject; Columns : Array of string); overload;
|
|
94
|
+
procedure time(aName : string);
|
|
95
|
+
procedure timeEnd(aName : string);
|
|
96
|
+
procedure trace;
|
|
97
|
+
procedure warn(Obj1 : JSValue); varargs of JSValue;
|
|
98
|
+
end;
|
|
99
|
+
|
|
100
|
+
{ ----------------------------------------------------------------------
|
|
101
|
+
Events
|
|
102
|
+
----------------------------------------------------------------------}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
TJSTimerCallBack = reference to procedure; safecall;
|
|
106
|
+
|
|
107
|
+
TJSEventInit = record
|
|
108
|
+
bubbles : boolean;
|
|
109
|
+
cancelable : boolean;
|
|
110
|
+
scoped : boolean;
|
|
111
|
+
composed : boolean;
|
|
112
|
+
end;
|
|
113
|
+
|
|
114
|
+
TJSEvent = class external name 'Event' (TJSObject)
|
|
115
|
+
Private
|
|
116
|
+
FBubbles : Boolean; external name 'bubbles';
|
|
117
|
+
FCancelable : Boolean; external name 'cancelable';
|
|
118
|
+
FComposed : Boolean; external name 'composed';
|
|
119
|
+
FCurrentTarget : TJSEventTarget; external name 'currentTarget';
|
|
120
|
+
FdefaultPrevented : Boolean; external name 'defaultPrevented';
|
|
121
|
+
FEventPhase : NativeInt; external name 'eventPhase';
|
|
122
|
+
FTarget : TJSEventTarget; external name 'target';
|
|
123
|
+
FTimeStamp : NativeInt; external name 'timestamp';
|
|
124
|
+
FType : String; external name 'type';
|
|
125
|
+
FIsTrusted : Boolean; external name 'isTrusted';
|
|
126
|
+
Public
|
|
127
|
+
Const
|
|
128
|
+
NONE = 0;
|
|
129
|
+
CAPTURING_PHASE = 1;
|
|
130
|
+
AT_TARGET = 2;
|
|
131
|
+
BUBBLING_PHASE = 3;
|
|
132
|
+
public
|
|
133
|
+
cancelBubble : Boolean;
|
|
134
|
+
constructor new (aType : String; const aInit : TJSEventInit); overload;
|
|
135
|
+
constructor new (aType : String); overload;
|
|
136
|
+
procedure preventDefault;
|
|
137
|
+
procedure stopImmediatePropagation;
|
|
138
|
+
procedure stopPropagation;
|
|
139
|
+
Property bubbles : Boolean Read FBubbles;
|
|
140
|
+
Property cancelable : Boolean Read FCancelable;
|
|
141
|
+
Property composed : Boolean Read FComposed;
|
|
142
|
+
property currentTarget : TJSEventTarget Read FCurrentTarget;
|
|
143
|
+
property defaultPrevented : Boolean Read FdefaultPrevented;
|
|
144
|
+
property eventPhase : NativeInt Read FEventPhase;
|
|
145
|
+
property target : TJSEventTarget Read FTarget;
|
|
146
|
+
Property timestamp : NativeInt Read FTimeStamp;
|
|
147
|
+
property _type : string read FType;
|
|
148
|
+
property isTrusted : Boolean Read FIsTrusted;
|
|
149
|
+
end;
|
|
150
|
+
|
|
151
|
+
TJSExtendableEvent = class external name 'ExtendableEvent' (TJSEvent)
|
|
152
|
+
Procedure waitUntil(aPromise : TJSPromise);
|
|
153
|
+
end;
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
TJSEventHandler = reference to function(Event: TJSEvent): boolean; safecall;
|
|
157
|
+
TJSRawEventHandler = reference to Procedure(Event: TJSEvent); safecall;
|
|
158
|
+
|
|
159
|
+
TJSEventListenerOptions = class external name 'Object' (TJSObject)
|
|
160
|
+
capture : boolean;
|
|
161
|
+
once : boolean;
|
|
162
|
+
passive : boolean;
|
|
163
|
+
signal : TJSAbortSignal;
|
|
164
|
+
end;
|
|
165
|
+
|
|
166
|
+
TJSEventTarget = class external name 'EventTarget' (TJSObject)
|
|
167
|
+
public
|
|
168
|
+
procedure addEventListener(aname : string; aListener : TJSEventHandler);
|
|
169
|
+
procedure addEventListener(aname : string; aListener : TJSRawEventHandler);
|
|
170
|
+
procedure addEventListener(aname : string; aListener : JSValue);
|
|
171
|
+
procedure addEventListener(aname : string; aListener : TJSEventHandler; useCapture : Boolean);
|
|
172
|
+
procedure addEventListener(aname : string; aListener : TJSRawEventHandler; useCapture : Boolean);
|
|
173
|
+
procedure addEventListener(aname : string; aListener : JSValue; useCapture : Boolean);
|
|
174
|
+
procedure addEventListener(aname : string; aListener : TJSEventHandler; options : TJSEventListenerOptions);
|
|
175
|
+
procedure addEventListener(aname : string; aListener : TJSRawEventHandler; options : TJSEventListenerOptions);
|
|
176
|
+
procedure addEventListener(aname : string; aListener : JSValue; options : TJSEventListenerOptions);
|
|
177
|
+
function dispatchEvent(event : JSValue) : Boolean;
|
|
178
|
+
procedure removeEventListener(aname : string; aListener : TJSEventHandler);
|
|
179
|
+
procedure removeEventListener(aname : string; aListener : TJSRawEventHandler);
|
|
180
|
+
procedure removeEventListener(aname : string; aListener : JSValue);
|
|
181
|
+
end;
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
TJSMessagePort = class external name 'MessagePort' (TJSEventTarget)
|
|
185
|
+
Public
|
|
186
|
+
procedure close;
|
|
187
|
+
procedure postMessage(aValue : JSValue);
|
|
188
|
+
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
|
|
189
|
+
procedure start;
|
|
190
|
+
end;
|
|
191
|
+
TJSMessagePortDynArray = Array of TJSMessagePort;
|
|
192
|
+
|
|
193
|
+
{ TJSMessageEvent }
|
|
194
|
+
|
|
195
|
+
TJSMessageEvent = class external name 'MessageEvent' (TJSEvent)
|
|
196
|
+
private
|
|
197
|
+
FData: JSValue; external name 'data';
|
|
198
|
+
FLastEventID: String; external name 'lastEventID';
|
|
199
|
+
FOrigin: String; external name 'origin';
|
|
200
|
+
FPorts: TJSMessagePortDynArray; external name 'ports';
|
|
201
|
+
FSource: TJSObject; external name 'source';
|
|
202
|
+
Public
|
|
203
|
+
Property Data : JSValue Read FData;
|
|
204
|
+
Property LastEventID : String Read FLastEventID;
|
|
205
|
+
Property Origin : String Read FOrigin;
|
|
206
|
+
Property Source : TJSObject Read FSource;
|
|
207
|
+
Property Ports : TJSMessagePortDynArray Read FPorts;
|
|
208
|
+
end;
|
|
209
|
+
|
|
210
|
+
{ TJSExtendableMessageEvent }
|
|
211
|
+
|
|
212
|
+
TJSExtendableMessageEvent = class external name 'ExtendableMessageEvent' (TJSExtendableEvent)
|
|
213
|
+
private
|
|
214
|
+
FData: JSValue; external name 'data';
|
|
215
|
+
FLastEventID: String; external name 'lastEventId';
|
|
216
|
+
FOrigin: String; external name 'origin';
|
|
217
|
+
FPorts: TJSMessagePortDynArray; external name 'ports';
|
|
218
|
+
FSource: TJSObject; external name 'source';
|
|
219
|
+
FSourceClient: TJSClient; external name 'source';
|
|
220
|
+
FSourcePort: TJSMessagePort; external name 'source';
|
|
221
|
+
FSourceServiceWorker: TJSServiceWorker; external name 'source';
|
|
222
|
+
Public
|
|
223
|
+
Property Data : JSValue Read FData;
|
|
224
|
+
Property LastEventID : String Read FLastEventID;
|
|
225
|
+
Property Origin : String Read FOrigin;
|
|
226
|
+
Property Ports : TJSMessagePortDynArray Read FPorts;
|
|
227
|
+
Property Source : TJSObject Read FSource;
|
|
228
|
+
// Possible types for Source
|
|
229
|
+
Property SourceServiceWorker : TJSServiceWorker Read FSourceServiceWorker;
|
|
230
|
+
Property SourcePort : TJSMessagePort Read FSourcePort;
|
|
231
|
+
Property SourceClient : TJSClient Read FSourceClient;
|
|
232
|
+
end;
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
{ TJSClient }
|
|
236
|
+
|
|
237
|
+
TJSClient = class external name 'Client' (TJSObject)
|
|
238
|
+
private
|
|
239
|
+
FFrameType: String; external name 'frameType';
|
|
240
|
+
FID: String; external name 'id';
|
|
241
|
+
FType: String; external name 'type';
|
|
242
|
+
FURL: String; external name 'url';
|
|
243
|
+
Public
|
|
244
|
+
procedure postMessage(aValue : JSValue);
|
|
245
|
+
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
|
|
246
|
+
Property Id : String Read FID;
|
|
247
|
+
Property Type_ : String Read FType;
|
|
248
|
+
Property FrameType : String Read FFrameType;
|
|
249
|
+
Property URL : String Read FURL;
|
|
250
|
+
end;
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
{ ----------------------------------------------------------------------
|
|
254
|
+
Fetch & Streams
|
|
255
|
+
----------------------------------------------------------------------}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
TJSStructuredSerializeOptions = class external name 'Object' (TJSObject)
|
|
259
|
+
transfer : TJSValueDynArray;
|
|
260
|
+
end;
|
|
261
|
+
|
|
262
|
+
TJSReadableStreamDefaultReader = class external name 'ReadableStreamDefaultReader' (TJSObject)
|
|
263
|
+
private
|
|
264
|
+
fclosed: TJSPromise; external name 'closed';
|
|
265
|
+
public
|
|
266
|
+
property closed: TJSPromise read fclosed;
|
|
267
|
+
constructor new(stream: TJSReadableStream);
|
|
268
|
+
function cancel(): TJSPromise; overload;
|
|
269
|
+
function cancel(reason: string): TJSPromise; overload;
|
|
270
|
+
function read(): TJSPromise;
|
|
271
|
+
function releaseLock(): TJSPromise;
|
|
272
|
+
end;
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
TJSReadableStream = class external name 'ReadableStream' (TJSObject)
|
|
276
|
+
private
|
|
277
|
+
flocked: Boolean; external name 'locked';
|
|
278
|
+
public
|
|
279
|
+
property locked: Boolean read flocked;
|
|
280
|
+
constructor new(underlyingSource: TJSObject);
|
|
281
|
+
constructor new(underlyingSource, queueingStrategy: TJSObject);
|
|
282
|
+
function cancel(reason: String): TJSPromise;
|
|
283
|
+
function getReader(): TJSReadableStreamDefaultReader; overload;
|
|
284
|
+
function getReader(mode: TJSObject): TJSReadableStreamDefaultReader; overload;
|
|
285
|
+
function pipeThrough(transformStream: TJSObject): TJSReadableStream; overload;
|
|
286
|
+
function pipeThrough(transformStream, options: TJSObject): TJSReadableStream; overload;
|
|
287
|
+
function pipeTo(destination: TJSObject): TJSPromise; overload;
|
|
288
|
+
function pipeTo(destination, options: TJSObject): TJSPromise; overload;
|
|
289
|
+
function tee(): TJSArray; // array containing two TJSReadableStream instances
|
|
290
|
+
end;
|
|
291
|
+
|
|
292
|
+
TJSWritableStream = class external name 'WritableStream' (TJSObject)
|
|
293
|
+
private
|
|
294
|
+
FLocked: Boolean; external name 'locked';
|
|
295
|
+
public
|
|
296
|
+
function abort(reason: String): TJSPromise;
|
|
297
|
+
function close: TJSPromise;
|
|
298
|
+
function getWriter: TJSObject;
|
|
299
|
+
property locked: Boolean read FLocked;
|
|
300
|
+
end;
|
|
301
|
+
|
|
302
|
+
TJSTransformStreamDefaultController = class external name 'TransformStreamDefaultController' (TJSObject)
|
|
303
|
+
desiredSize : NativeInt;
|
|
304
|
+
procedure enqueue(aChunk : JSValue);
|
|
305
|
+
procedure error(aReason : string);
|
|
306
|
+
procedure terminate;
|
|
307
|
+
end;
|
|
308
|
+
|
|
309
|
+
TJSWritableStrategySizeHandler = Reference to Function (aChunk : JSValue) : integer;
|
|
310
|
+
|
|
311
|
+
TJSTranformStreamWritableStrategy = class external name 'Object' (TJSObject)
|
|
312
|
+
highWaterMark : Cardinal;
|
|
313
|
+
size : TJSWritableStrategySizeHandler;
|
|
314
|
+
end;
|
|
315
|
+
|
|
316
|
+
TJSTransformStreamControllerProc = reference to procedure(aController : TJSTransformStreamDefaultController);
|
|
317
|
+
TJSTransformStreamControllerTransformProc = reference to procedure(aChunk : JSValue; aController : TJSTransformStreamDefaultController);
|
|
318
|
+
TJSTransformStreamControllerTransformFunc = reference to function(aChunk : JSValue; aController : TJSTransformStreamDefaultController) : TJSPromise;
|
|
319
|
+
|
|
320
|
+
TJSTransformStreamController = class external name 'Object' (TJSObject)
|
|
321
|
+
start : TJSTransformStreamControllerProc;
|
|
322
|
+
transform : TJSTransformStreamControllerTransformProc;
|
|
323
|
+
transformFunc : TJSTransformStreamControllerTransformFunc; external name 'transform';
|
|
324
|
+
flush : TJSTransformStreamControllerProc;
|
|
325
|
+
end;
|
|
326
|
+
|
|
327
|
+
TJSTransformStream = class external name 'TransformStream' (TJSObject)
|
|
328
|
+
constructor new;
|
|
329
|
+
constructor new(controller : TJSTransformStreamController);
|
|
330
|
+
constructor new(controller : TJSTransformStreamController; WritableStrategy : TJSTranformStreamWritableStrategy);
|
|
331
|
+
readable : TJSReadableStream;
|
|
332
|
+
writable : TJSWritableStream;
|
|
333
|
+
end;
|
|
334
|
+
|
|
335
|
+
TJSBlobInit = class external name 'Object' (TJSObject)
|
|
336
|
+
type_ : string; external name 'type';
|
|
337
|
+
endings : string;
|
|
338
|
+
end;
|
|
339
|
+
|
|
340
|
+
TJSBlob = class external name 'Blob' (TJSEventTarget)
|
|
341
|
+
private
|
|
342
|
+
FSize: NativeInt; external name 'size';
|
|
343
|
+
FType: string; external name 'type';
|
|
344
|
+
Public
|
|
345
|
+
constructor New(aBlobParts: TJSArray); overload;
|
|
346
|
+
constructor New(aBlobParts: TJSArray; AOptions: TJSBlobInit); overload;
|
|
347
|
+
constructor New(aBlobParts: TJSValueDynArray); overload;
|
|
348
|
+
constructor New(aBlobParts: TJSValueDynArray; AOptions: TJSBlobInit); overload;
|
|
349
|
+
procedure close;
|
|
350
|
+
function slice : TJSBlob; overload;
|
|
351
|
+
function slice(aStart : NativeInt) : TJSBlob; overload;
|
|
352
|
+
function slice(aStart,aEnd : NativeInt) : TJSBlob; overload;
|
|
353
|
+
function slice(aStart,aEnd : NativeInt; AContentType : String) : TJSBlob; overload;
|
|
354
|
+
function arrayBuffer : TJSPromise;
|
|
355
|
+
function bytes: TJSPromise;
|
|
356
|
+
function stream: TJSReadableStream;
|
|
357
|
+
function text: TJSPromise;
|
|
358
|
+
property size : NativeInt read FSize;
|
|
359
|
+
property _type : string read FType; deprecated;
|
|
360
|
+
property type_ : string read FType;
|
|
361
|
+
end;
|
|
362
|
+
|
|
363
|
+
TJSFileNewOptions = class external name 'Object' (TJSObject)
|
|
364
|
+
type_ : string; external name 'type';
|
|
365
|
+
lastModifier : NativeInt;
|
|
366
|
+
end;
|
|
367
|
+
|
|
368
|
+
{ TJSFile }
|
|
369
|
+
|
|
370
|
+
TJSFile = class external name 'File' (TJSBlob)
|
|
371
|
+
private
|
|
372
|
+
fLastModified: NativeInt; external name 'lastModified';
|
|
373
|
+
fLastModifiedDate: TJSDate; external name 'lastModifiedDate';
|
|
374
|
+
fname: String; external name 'name';
|
|
375
|
+
public
|
|
376
|
+
constructor new(Bits : TJSArray; const aName: string);
|
|
377
|
+
constructor new(Bits: TJSDataView; const aName : string);
|
|
378
|
+
constructor new(Bits : TJSArray; const aName: string; aOptions : TJSFileNewOptions);
|
|
379
|
+
constructor new(Bits: TJSDataView; const aName : string; aOptions : TJSFileNewOptions);
|
|
380
|
+
property Name : String read fname;
|
|
381
|
+
property lastModified : NativeInt Read fLastModified;
|
|
382
|
+
property lastModifiedDate : TJSDate Read fLastModifiedDate;
|
|
383
|
+
end;
|
|
384
|
+
|
|
385
|
+
TJSBody = class external name 'Body' (TJSObject)
|
|
386
|
+
private
|
|
387
|
+
fbody: TJSReadableStream; external name 'body';
|
|
388
|
+
fbodyUsed: Boolean; external name 'bodyUsed';
|
|
389
|
+
public
|
|
390
|
+
property body: TJSReadableStream read fbody;
|
|
391
|
+
property bodyUsed: Boolean read fbodyUsed;
|
|
392
|
+
function arrayBuffer(): TJSPromise; // resolves to TJSArrayBuffer
|
|
393
|
+
function blobPromise(): TJSPromise; // resolves to TJSBlob
|
|
394
|
+
function blob: TJSBlob; {$IFNDEF SkipAsync}async;{$ENDIF}
|
|
395
|
+
function json(): TJSPromise; // resolves to JSON / TJSValue
|
|
396
|
+
//function text(): TJSPromise; // resolves to USVString, always decoded using UTF-8
|
|
397
|
+
function text(): string; {$IFNDEF SkipAsync}async;{$ENDIF}
|
|
398
|
+
end;
|
|
399
|
+
|
|
400
|
+
Theader = Array [0..1] of String;
|
|
401
|
+
THeaderArray = Array of Theader;
|
|
402
|
+
|
|
403
|
+
TJSHTMLHeaders = Class external name 'Headers' (TJSObject)
|
|
404
|
+
Public
|
|
405
|
+
constructor new(values : THeaderArray); overload;
|
|
406
|
+
procedure append(aName, aValue : String);
|
|
407
|
+
procedure delete(aName : String);
|
|
408
|
+
function entries : TJSIterator;
|
|
409
|
+
Function get(aName: String): string; // string, but can be Null. Only use after Has returned true.
|
|
410
|
+
function getRaw(const aName : string): JSValue; external name 'get'; // can return null
|
|
411
|
+
Function has(aName: String): Boolean;
|
|
412
|
+
function keys : TJSIterator; reintroduce;
|
|
413
|
+
function values : TJSIterator; reintroduce;
|
|
414
|
+
procedure set_(aName, aValue : String);
|
|
415
|
+
Property Headers[aName : string] : string Read Get Write Set_; default;
|
|
416
|
+
end;
|
|
417
|
+
|
|
418
|
+
TJSResponseInit = class external name 'Object'
|
|
419
|
+
status : Integer;
|
|
420
|
+
statusText : String;
|
|
421
|
+
headersObj : TJSObject;
|
|
422
|
+
headers : TJSHTMLHeaders;
|
|
423
|
+
end;
|
|
424
|
+
|
|
425
|
+
TJSResponse = class external name 'Response' (TJSBody)
|
|
426
|
+
private
|
|
427
|
+
fheaders: TJSHTMLHeaders; external name 'headers';
|
|
428
|
+
fok: Boolean; external name 'ok';
|
|
429
|
+
fredirected: Boolean; external name 'redirected';
|
|
430
|
+
fstatus: NativeInt; external name 'status';
|
|
431
|
+
fstatusText: String; external name 'statusText';
|
|
432
|
+
ftype: String; external name 'type';
|
|
433
|
+
furl: String; external name 'url';
|
|
434
|
+
fuseFinalUrl: Boolean; external name 'useFinalUrl';
|
|
435
|
+
public
|
|
436
|
+
constructor new(body: TJSObject); overload; external name 'new';
|
|
437
|
+
constructor new(body: TJSObject; init: TJSObject); overload; external name 'new'; deprecated;
|
|
438
|
+
constructor new(body: TJSObject; init: TJSResponseInit); overload; external name 'new';
|
|
439
|
+
constructor new(Msg: string); overload; external name 'new';
|
|
440
|
+
constructor new(Msg: string; init: TJSObject); overload; external name 'new'; deprecated;
|
|
441
|
+
constructor new(Msg: string; init: TJSResponseInit); overload; external name 'new';
|
|
442
|
+
|
|
443
|
+
function clone(): TJSResponse;
|
|
444
|
+
function error(): TJSResponse;
|
|
445
|
+
function redirect(url: String; Status: NativeInt): TJSResponse;
|
|
446
|
+
property headers: TJSHTMLHeaders read fheaders; //
|
|
447
|
+
property ok: Boolean read fok;
|
|
448
|
+
property redirected: Boolean read fredirected;
|
|
449
|
+
property status: NativeInt read fstatus;
|
|
450
|
+
property statusText: String read fstatusText; //
|
|
451
|
+
property type_: String read ftype; //
|
|
452
|
+
property url: String read furl; //
|
|
453
|
+
property useFinalUrl: Boolean read fuseFinalUrl write fuseFinalUrl;
|
|
454
|
+
end;
|
|
455
|
+
|
|
456
|
+
TJSFormData = class external name 'FormData' (TJSObject)
|
|
457
|
+
public
|
|
458
|
+
procedure append(const aName, aValue: string); overload;
|
|
459
|
+
procedure append(const aName: string; const aValue: TJSBlob); overload;
|
|
460
|
+
procedure append(const aName: string; const aValue: TJSBlob; const aFileName: string); overload;
|
|
461
|
+
procedure delete(const aName: string);
|
|
462
|
+
function entries : TJSIterator;
|
|
463
|
+
function get(const aName : string): JSValue; //string or TJSFile
|
|
464
|
+
function getAll: TJSArray; // of FormDataEntryValue(string or TJSFile)
|
|
465
|
+
function has(const aName : string): Boolean;
|
|
466
|
+
function keys: TJSIterator; reintroduce;
|
|
467
|
+
procedure set_(const aName, aValue: string); overload; external name 'set';
|
|
468
|
+
procedure set_(const aName, aValue, aFileName: string); overload; external name 'set';
|
|
469
|
+
procedure set_(const aName: string; const aValue: TJSBlob); overload; external name 'set';
|
|
470
|
+
procedure set_(const aName: string; const aValue: TJSBlob; const aFileName: string); overload; external name 'set';
|
|
471
|
+
function values: TJSIterator; reintroduce;
|
|
472
|
+
end;
|
|
473
|
+
|
|
474
|
+
{ TJSRequest }
|
|
475
|
+
|
|
476
|
+
TJSRequest = class external name 'Request' (TJSObject)
|
|
477
|
+
private
|
|
478
|
+
FBody: TJSReadableStream; external name 'body';
|
|
479
|
+
FBodyUsed: Boolean; external name 'bodyUsed';
|
|
480
|
+
FCache: String; external name 'cache';
|
|
481
|
+
FCredentials: TJSObject; external name 'credentials';
|
|
482
|
+
FDestination: String; external name 'destination';
|
|
483
|
+
FHeaders: TJSHTMLHeaders; external name 'headers';
|
|
484
|
+
FIntegrity: String; external name 'integrity';
|
|
485
|
+
FMethod: String; external name 'method';
|
|
486
|
+
FMode: String; external name 'mode';
|
|
487
|
+
FReferrer: string; external name 'referrer';
|
|
488
|
+
FReferrerPolicy: string; external name 'referrerPolicy';
|
|
489
|
+
FURL: String;external name 'url';
|
|
490
|
+
Public
|
|
491
|
+
constructor new(aInput: string); overload;
|
|
492
|
+
constructor new(aInput: string; aOptions: TJSObject); overload;
|
|
493
|
+
function arrayBuffer: TJSPromise; // TJSArrayBuffer
|
|
494
|
+
function blob: TJSPromise; // TJSBlob
|
|
495
|
+
function clone: TJSRequest;
|
|
496
|
+
function formData: TJSPromise; // TJSFormData
|
|
497
|
+
function json: TJSPromise; // TJSJSON
|
|
498
|
+
function text: TJSPromise; // string
|
|
499
|
+
Property body : TJSReadableStream Read FBody;
|
|
500
|
+
property bodyUsed : Boolean Read FBodyUsed;
|
|
501
|
+
Property Cache : String Read FCache;
|
|
502
|
+
Property Credentials : TJSObject Read FCredentials;
|
|
503
|
+
Property Destination : String Read FDestination;
|
|
504
|
+
Property Headers : TJSHTMLHeaders Read FHeaders;
|
|
505
|
+
Property Integrity : String Read FIntegrity;
|
|
506
|
+
Property Method : String Read FMethod;
|
|
507
|
+
Property Mode : String Read FMode;
|
|
508
|
+
Property Referrer : string Read FReferrer;
|
|
509
|
+
Property ReferrerPolicy : string Read FReferrerPolicy;
|
|
510
|
+
Property URL : String Read FURL;
|
|
511
|
+
end;
|
|
512
|
+
TJSRequestDynArray = array of TJSRequest;
|
|
513
|
+
|
|
514
|
+
{ TJSFetchEvent }
|
|
515
|
+
|
|
516
|
+
TJSFetchEvent = class external name 'FetchEvent' (TJSExtendableEvent)
|
|
517
|
+
private
|
|
518
|
+
FClientID: String; external name 'clientId';
|
|
519
|
+
FReplacesClientID: String; external name 'replacesClientId';
|
|
520
|
+
FRequest: TJSRequest; external name 'request';
|
|
521
|
+
FResultingClientID: String; external name 'resultingClientId';
|
|
522
|
+
FPreloadResponse: TJSPromise; external name 'preloadResponse';
|
|
523
|
+
Public
|
|
524
|
+
Procedure respondWith(aPromise : TJSPromise);
|
|
525
|
+
Procedure respondWith(aResponse : TJSResponse);
|
|
526
|
+
Property ClientId : String Read FClientID;
|
|
527
|
+
Property PreloadResponse : TJSPromise Read FPreloadResponse;
|
|
528
|
+
Property ReplacesClientID : String Read FReplacesClientID;
|
|
529
|
+
Property ResultingClientID : String Read FResultingClientID;
|
|
530
|
+
Property request : TJSRequest Read FRequest;
|
|
531
|
+
end;
|
|
532
|
+
|
|
533
|
+
{ ----------------------------------------------------------------------
|
|
534
|
+
IndexedDB
|
|
535
|
+
----------------------------------------------------------------------}
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
TJSIDBTransactionMode = class
|
|
539
|
+
const
|
|
540
|
+
readonly = 'readonly';
|
|
541
|
+
readwrite = 'readwrite';
|
|
542
|
+
versionchange = 'versionchange';
|
|
543
|
+
end;
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
{ TJSIDBTransaction }
|
|
547
|
+
|
|
548
|
+
TJSIDBTransaction = class external name 'IDBTransaction' (TJSEventTarget)
|
|
549
|
+
private
|
|
550
|
+
FDB : TIDBDatabase; external name 'db';
|
|
551
|
+
FError: JSValue; external name 'error';
|
|
552
|
+
FMode: String; external name 'mode';
|
|
553
|
+
FObjectStoreNames: TStringDynArray; external name 'objectStoreNames';
|
|
554
|
+
public
|
|
555
|
+
procedure abort;
|
|
556
|
+
function objectStore(aName : String) : TJSIDBObjectStore;
|
|
557
|
+
property db : TIDBDatabase read FDB;
|
|
558
|
+
property mode : String read FMode;
|
|
559
|
+
property objectStoreNames : TStringDynArray read FObjectStoreNames;
|
|
560
|
+
property error : JSValue read FError;
|
|
561
|
+
end;
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
{ TJSIDBKeyRange }
|
|
565
|
+
|
|
566
|
+
TJSIDBKeyRange = class external name 'IDBKeyRange' (TJSObject)
|
|
567
|
+
private
|
|
568
|
+
FLower: JSValue;
|
|
569
|
+
FLowerOpen: Boolean;
|
|
570
|
+
FUpper: JSValue;
|
|
571
|
+
FUpperOpen: Boolean;
|
|
572
|
+
Public
|
|
573
|
+
Class Function bound(aLower,aUpper : JSValue) : TJSIDBKeyRange; overload;
|
|
574
|
+
Class Function bound(aLower,aUpper : JSValue; aLowerOpen : Boolean) : TJSIDBKeyRange; overload;
|
|
575
|
+
Class Function bound(aLower,aUpper : JSValue; aLowerOpen,aUpperOpen : Boolean) : TJSIDBKeyRange; overload;
|
|
576
|
+
Class Function lowerBound(aLower : JSValue) : TJSIDBKeyRange; overload;
|
|
577
|
+
Class Function lowerBound(aLower : JSValue; aOpen: Boolean) : TJSIDBKeyRange; overload;
|
|
578
|
+
Class Function only(aValue : JSValue) : TJSIDBKeyRange;
|
|
579
|
+
Class Function upperBound(aUpper : JSValue) : TJSIDBKeyRange; overload;
|
|
580
|
+
Class Function upperBound(aUpper : JSValue; aOpen: Boolean) : TJSIDBKeyRange; overload;
|
|
581
|
+
function includes (aValue : JSValue) : Boolean;
|
|
582
|
+
property lower : JSValue read FLower;
|
|
583
|
+
property lowerOpen : Boolean read FLowerOpen;
|
|
584
|
+
property upper : JSValue read FUpper;
|
|
585
|
+
property upperOpen : Boolean read FUpperOpen;
|
|
586
|
+
end;
|
|
587
|
+
|
|
588
|
+
TJSIDBIndexParameters = record
|
|
589
|
+
unique : boolean;
|
|
590
|
+
multiEntry : boolean;
|
|
591
|
+
locale : string;
|
|
592
|
+
end;
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
{ TJSIDBIndex }
|
|
596
|
+
|
|
597
|
+
TJSIDBIndex = class external name 'IDBIndex' (TJSObject)
|
|
598
|
+
private
|
|
599
|
+
FKeyPath: JSValue; external name 'keyPath';
|
|
600
|
+
FMultiEntry: Boolean; external name 'multiEntry';
|
|
601
|
+
FObjectStore: TJSIDBObjectStore; external name 'objectStore';
|
|
602
|
+
FUnique: boolean; external name 'unique';
|
|
603
|
+
public
|
|
604
|
+
name : string;
|
|
605
|
+
function count : TJSIDBRequest;
|
|
606
|
+
function get(aKey : jsValue) : TJSIDBRequest; overload;
|
|
607
|
+
function get(aKey : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
608
|
+
function getAll(aKey : jsValue) : TJSIDBRequest; overload;
|
|
609
|
+
function getAll(aKey : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
610
|
+
function getAll(aKey : jsValue; ACount : NativeInt) : TJSIDBRequest; overload;
|
|
611
|
+
function getAll(aKey : TJSIDBKeyRange; ACount : NativeInt) : TJSIDBRequest; overload;
|
|
612
|
+
function getAllKeys(aKey : jsValue) : TJSIDBRequest; overload;
|
|
613
|
+
function getAllKeys(aKey : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
614
|
+
function getAllKeys(aKey : jsValue; ACount : NativeInt) : TJSIDBRequest; overload;
|
|
615
|
+
function getAllKeys(aKey : TJSIDBKeyRange; ACount : NativeInt) : TJSIDBRequest; overload;
|
|
616
|
+
function getKey(aKey : jsValue) : TJSIDBRequest;
|
|
617
|
+
function openCursor : TJSIDBRequest; overload;
|
|
618
|
+
function openCursor(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
619
|
+
function openCursor(aKeyRange : TJSIDBKeyRange; ADirection : String) : TJSIDBRequest;overload;
|
|
620
|
+
function openKeyCursor : TJSIDBRequest;overload;
|
|
621
|
+
function openKeyCursor(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest;overload;
|
|
622
|
+
function openKeyCursor(aKeyRange : TJSIDBKeyRange; ADirection : String) : TJSIDBRequest;overload;
|
|
623
|
+
Property keyPath : JSValue Read FKeyPath;
|
|
624
|
+
property multiEntry : Boolean read FMultiEntry;
|
|
625
|
+
property objectStore : TJSIDBObjectStore read FObjectStore;
|
|
626
|
+
property unique : boolean read FUnique;
|
|
627
|
+
end;
|
|
628
|
+
|
|
629
|
+
TJSIDBCursorDirection = class external name 'IDBCursorDirection' (TJSObject)
|
|
630
|
+
Const
|
|
631
|
+
next = 'next';
|
|
632
|
+
nextUnique = 'nextUnique';
|
|
633
|
+
prev = 'prev';
|
|
634
|
+
prevUnique = 'prevUnique';
|
|
635
|
+
end;
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
{ TJSIDBCursor }
|
|
639
|
+
|
|
640
|
+
TJSIDBCursor = class external name 'IDBCursor' (TJSObject)
|
|
641
|
+
private
|
|
642
|
+
FDirection: string; external name 'direction';
|
|
643
|
+
FKey: JSValue; external name 'key';
|
|
644
|
+
FValue : JSValue; external name 'value';
|
|
645
|
+
FPrimaryKey: JSValue; external name 'primaryKey';
|
|
646
|
+
FSource: JSValue; external name 'source';
|
|
647
|
+
FSourceAsIndex: TJSIDBIndex; external name 'source';
|
|
648
|
+
FSourceAsStore: TJSIDBObjectStore; external name 'source';
|
|
649
|
+
Public
|
|
650
|
+
procedure advance(aCount : NativeInt); overload;
|
|
651
|
+
procedure advance(aKey : JSValue); overload;
|
|
652
|
+
procedure continue(aKey : JSValue); overload;
|
|
653
|
+
procedure continue; overload;
|
|
654
|
+
procedure continuePrimaryKey(aKey : JSValue); overload;
|
|
655
|
+
procedure continuePrimaryKey(aKey,aPrimaryKey : JSValue); overload;
|
|
656
|
+
procedure delete;
|
|
657
|
+
procedure update(aValue : JSValue);
|
|
658
|
+
property source : JSValue read FSource;
|
|
659
|
+
property sourceAsStore : TJSIDBObjectStore read FSourceAsStore;
|
|
660
|
+
property sourceAsIndex : TJSIDBIndex read FSourceAsIndex;
|
|
661
|
+
property key : JSValue read FKey;
|
|
662
|
+
Property Value : JSValue Read FValue;
|
|
663
|
+
property primaryKey : JSValue read FPrimaryKey;
|
|
664
|
+
property direction : string read FDirection;
|
|
665
|
+
end;
|
|
666
|
+
|
|
667
|
+
TJSIDBObjectStore = class external name 'IDBObjectStore' (TJSEventTarget)
|
|
668
|
+
public
|
|
669
|
+
function add(aValue : JSValue; aKey : String) : TJSIDBRequest;
|
|
670
|
+
function add(aValue : JSValue) : TJSIDBRequest;
|
|
671
|
+
function clear : TJSIDBRequest;
|
|
672
|
+
function delete(aKey : string) : TJSIDBRequest;
|
|
673
|
+
function delete(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest;
|
|
674
|
+
function get(aKey : string) : TJSIDBRequest; overload;
|
|
675
|
+
function get(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
676
|
+
function getKey(aKey : string) : TJSIDBRequest; overload;
|
|
677
|
+
function getKey(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
678
|
+
function getAll : TJSIDBRequest; overload;
|
|
679
|
+
function getAll(aKey : String) : TJSIDBRequest; overload;
|
|
680
|
+
function getAll(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
681
|
+
function getAll(aKey : String; aCount: NativeInt) : TJSIDBRequest; overload;
|
|
682
|
+
function getAll(aKeyRange : TJSIDBKeyRange; aCount: NativeInt) : TJSIDBRequest; overload;
|
|
683
|
+
function getAllKeys(aKey : String) : TJSIDBRequest; overload;
|
|
684
|
+
function getAllKeys(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
685
|
+
function getAllKeys(aKey : String; aCount: NativeInt) : TJSIDBRequest; overload;
|
|
686
|
+
function getAllKeys(aKeyRange : TJSIDBKeyRange; aCount: NativeInt) : TJSIDBRequest; overload;
|
|
687
|
+
function createIndex (aIndexName : String; KeyPath : String) : TJSIDBIndex; overload;
|
|
688
|
+
function createIndex (aIndexName : String; KeyPath : String; Options : TJSIDBIndexParameters) : TJSIDBIndex; overload;
|
|
689
|
+
function createIndex (aIndexName : String; KeyPath : Array of String) : TJSIDBIndex; overload;
|
|
690
|
+
function createIndex (aIndexName : String; KeyPath : Array of String; Options : TJSIDBIndexParameters) : TJSIDBIndex; overload;
|
|
691
|
+
Procedure deleteIndex (aIndexName : String);
|
|
692
|
+
function index (aIndexName : String) : TJSIDBIndex;
|
|
693
|
+
function put(aValue : JSValue; aKey : String) : TJSIDBRequest; overload;
|
|
694
|
+
function put(aValue : JSValue) : TJSIDBRequest; overload;
|
|
695
|
+
function openCursor : TJSIDBRequest; overload;
|
|
696
|
+
function openCursor(aKey : String) : TJSIDBRequest; overload;
|
|
697
|
+
function openCursor(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
698
|
+
function openCursor(aKey : String; aDirection : string) : TJSIDBRequest; overload;
|
|
699
|
+
function openCursor(aKeyRange : TJSIDBKeyRange; aDirection : string) : TJSIDBRequest; overload;
|
|
700
|
+
function openKeyCursor : TJSIDBRequest; overload;
|
|
701
|
+
function openKeyCursor(aKey : String) : TJSIDBRequest; overload;
|
|
702
|
+
function openKeyCursor(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
703
|
+
function openKeyCursor(aKey : String; aDirection : string) : TJSIDBRequest; overload;
|
|
704
|
+
function openKeyCursor(aKeyRange : TJSIDBKeyRange; aDirection : string) : TJSIDBRequest; overload;
|
|
705
|
+
function count : TJSIDBRequest; overload;
|
|
706
|
+
function count(aKey : String) : TJSIDBRequest; overload;
|
|
707
|
+
function count(aKeyRange : TJSIDBKeyRange) : TJSIDBRequest; overload;
|
|
708
|
+
property Indexes [aIndexName : String] : TJSIDBIndex read index;
|
|
709
|
+
end;
|
|
710
|
+
|
|
711
|
+
{ TJSIDBRequest }
|
|
712
|
+
|
|
713
|
+
TJSIDBRequest = class external name 'IDBRequest' (TJSEventTarget)
|
|
714
|
+
private
|
|
715
|
+
Ferror : JSValue; external name 'error'; // standards are not quite clear on this one
|
|
716
|
+
FReadyState: string; external name 'readyState';
|
|
717
|
+
FResult: JSValue; external name 'result';
|
|
718
|
+
FResultDatabase: TIDBDatabase; external name 'result';
|
|
719
|
+
FResultIndex: TJSIDBIndex; external name 'result';
|
|
720
|
+
FResultObjectStore : TJSIDBObjectStore; external name 'result';
|
|
721
|
+
FResultCursor : TJSIDBCursor; external name 'result';
|
|
722
|
+
FSourceDatabase: TIDBDatabase; external name 'source';
|
|
723
|
+
FSourceIndex: TJSIDBIndex; external name 'source';
|
|
724
|
+
FSourceObjectStore : TJSIDBObjectStore; external name 'source';
|
|
725
|
+
FSourceCursor : TJSIDBCursor; external name 'source';
|
|
726
|
+
FSource: JSValue; external name 'source';
|
|
727
|
+
FTransaction: TJSIDBTransaction; external name 'transaction';
|
|
728
|
+
Public
|
|
729
|
+
onerror : TJSEventHandler;
|
|
730
|
+
onsuccess : TJSEventHandler;
|
|
731
|
+
Property error : JSValue read FError;
|
|
732
|
+
property readyState : string read FReadyState;
|
|
733
|
+
|
|
734
|
+
property result : JSValue read FResult;
|
|
735
|
+
property resultAsObjectStore : TJSIDBObjectStore read FResultObjectStore;
|
|
736
|
+
property resultAsCursor : TJSIDBCursor read FResultCursor;
|
|
737
|
+
property resultAsIndex : TJSIDBIndex read FResultIndex;
|
|
738
|
+
property resultAsDatabase : TIDBDatabase read FResultDatabase;
|
|
739
|
+
|
|
740
|
+
property source : JSValue read FSource;
|
|
741
|
+
property sourceAsObjectStore : TJSIDBObjectStore read FSourceObjectStore;
|
|
742
|
+
property sourceAsCursor : TJSIDBCursor read FSourceCursor;
|
|
743
|
+
property sourceAsIndex : TJSIDBIndex read FSourceIndex;
|
|
744
|
+
property sourceAsDatabase : TIDBDatabase read FSourceDatabase;
|
|
745
|
+
|
|
746
|
+
property transaction : TJSIDBTransaction read FTransaction;
|
|
747
|
+
end;
|
|
748
|
+
|
|
749
|
+
TJSIDBOpenDBRequest = class external name 'IDBOpenDBRequest' (TJSIDBRequest)
|
|
750
|
+
Public
|
|
751
|
+
onblocked : TJSEventHandler;
|
|
752
|
+
onupgradeneeded : TJSEventHandler;
|
|
753
|
+
end;
|
|
754
|
+
|
|
755
|
+
TJSCreateObjectStoreOptions = record
|
|
756
|
+
keyPath : jsValue;
|
|
757
|
+
autoIncrement : boolean;
|
|
758
|
+
end;
|
|
759
|
+
|
|
760
|
+
{ TIDBDatabase }
|
|
761
|
+
|
|
762
|
+
TIDBDatabase = class external name 'IDBDatabase' (TJSEventTarget)
|
|
763
|
+
private
|
|
764
|
+
FName: string; external name 'name';
|
|
765
|
+
FobjectStoreNames: TStringDynArray; external name 'objectStoreNames';
|
|
766
|
+
FVersion: integer; external name 'version';
|
|
767
|
+
public
|
|
768
|
+
procedure close;
|
|
769
|
+
function createObjectStore(aName : string) : TJSIDBObjectStore; overload;
|
|
770
|
+
function createObjectStore(aName : string; Options: TJSCreateObjectStoreOptions) : TJSIDBObjectStore; overload;
|
|
771
|
+
procedure deleteObjectStore(aName : string);
|
|
772
|
+
function transaction(aStoreNames : array of string) : TJSIDBTransaction; overload;
|
|
773
|
+
function transaction(aStoreNames : array of string; aMode : string) : TJSIDBTransaction; overload;
|
|
774
|
+
property name : string read FName;
|
|
775
|
+
property version : integer read FVersion;
|
|
776
|
+
property objectStoreNames : TStringDynArray read FobjectStoreNames;
|
|
777
|
+
end;
|
|
778
|
+
|
|
779
|
+
TJSIDBFactory = class external name 'IDBFactory' (TJSEventTarget)
|
|
780
|
+
public
|
|
781
|
+
function open(aName : string) : TJSIDBOpenDBRequest;
|
|
782
|
+
function open(aName : string; aVersion : Integer) : TJSIDBOpenDBRequest;
|
|
783
|
+
function deleteDatabase(aName : string) : TJSIDBOpenDBRequest;
|
|
784
|
+
function cmp (a,b : jsValue) : NativeInt;
|
|
785
|
+
end;
|
|
786
|
+
|
|
787
|
+
{ ----------------------------------------------------------------------
|
|
788
|
+
Cache
|
|
789
|
+
----------------------------------------------------------------------}
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
TJSCacheDeleteOptions = class external name 'Object' (TJSObject)
|
|
793
|
+
ignoreSearch : Boolean;
|
|
794
|
+
ignoreMethod : Boolean;
|
|
795
|
+
ignoreVary : Boolean;
|
|
796
|
+
cacheName : string;
|
|
797
|
+
end;
|
|
798
|
+
|
|
799
|
+
TJSParamEnumCallBack = reference to procedure (const aKey,aValue : string);
|
|
800
|
+
|
|
801
|
+
TJSURLSearchParams = class external name 'URLSearchParams' (TJSObject)
|
|
802
|
+
Public
|
|
803
|
+
constructor new(aQuery : String);
|
|
804
|
+
Procedure append(const aName,aValue : string);
|
|
805
|
+
Procedure delete(const aName : string);
|
|
806
|
+
Function entries : TJSIterator;
|
|
807
|
+
Procedure foreach(aEnumCallBack : TJSParamEnumCallBack);
|
|
808
|
+
function get(const aName : string) : JSValue;
|
|
809
|
+
// If you're sure the value exists...
|
|
810
|
+
function getString(const aName : string) : string; external name 'get';
|
|
811
|
+
function getAll(const aName : string) : TStringDynArray;
|
|
812
|
+
function has(const aName : string) : Boolean;
|
|
813
|
+
Function keys : TJSIterator; reintroduce;
|
|
814
|
+
Procedure set_(const aName,aValue : string); external name 'set';
|
|
815
|
+
Procedure sort;
|
|
816
|
+
Function values : TJSIterator; reintroduce;
|
|
817
|
+
end;
|
|
818
|
+
|
|
819
|
+
TJSURL = class external name 'URL' (TJSObject)
|
|
820
|
+
Private
|
|
821
|
+
FOrigin : String; external name 'origin';
|
|
822
|
+
FSearchParams : TJSURLSearchParams; external name 'searchParams';
|
|
823
|
+
public
|
|
824
|
+
hash : string;
|
|
825
|
+
host : string;
|
|
826
|
+
hostname : string;
|
|
827
|
+
href : string;
|
|
828
|
+
password : string;
|
|
829
|
+
pathname : string;
|
|
830
|
+
port : string;
|
|
831
|
+
protocol : string;
|
|
832
|
+
search : string;
|
|
833
|
+
username : string;
|
|
834
|
+
constructor new(aURL : String);
|
|
835
|
+
constructor new(aURL,aBase : String);
|
|
836
|
+
class function createObjectURL(const v: JSValue): string;
|
|
837
|
+
class function revokeObjectURL(const S : String): string;
|
|
838
|
+
function toJSON : String;
|
|
839
|
+
Property Origin : String Read FOrigin;
|
|
840
|
+
property SearchParams : TJSURLSearchParams read FSearchParams;
|
|
841
|
+
end;
|
|
842
|
+
TJSURLDynArray = array of TJSURL;
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
{ TJSNavigationPreloadState }
|
|
846
|
+
|
|
847
|
+
TJSNavigationPreloadState = class external name 'navigationPreloadState'
|
|
848
|
+
public
|
|
849
|
+
enabled: boolean;
|
|
850
|
+
headerValue: string;
|
|
851
|
+
end;
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
{ TJSCache }
|
|
855
|
+
|
|
856
|
+
TJSCache = class external name 'Cache' (TJSObject)
|
|
857
|
+
Public
|
|
858
|
+
Function add(aRequest : String) : TJSPromise;
|
|
859
|
+
Function add(aRequest : TJSURL) : TJSPromise;
|
|
860
|
+
Function addAll(aRequests : TJSStringDynArray) : TJSPromise;
|
|
861
|
+
Function addAll(aRequests : TJSURLDynArray) : TJSPromise;
|
|
862
|
+
Function addAll(aRequests : TJSValueDynArray) : TJSPromise;
|
|
863
|
+
Function put(aRequest : String; aResponse : TJSResponse) : TJSPromise;
|
|
864
|
+
Function put(aRequest : TJSRequest; aResponse : TJSResponse) : TJSPromise;
|
|
865
|
+
Function delete(aRequest : String) : TJSPromise;
|
|
866
|
+
Function delete(aRequest : TJSRequest) : TJSPromise;
|
|
867
|
+
Function delete(aRequest : String; aOptions : TJSObject) : TJSPromise;
|
|
868
|
+
Function delete(aRequest : TJSRequest; aOptions : TJSObject) : TJSPromise;
|
|
869
|
+
Function delete(aRequest : String; aOptions : TJSCacheDeleteOptions) : TJSPromise;
|
|
870
|
+
Function delete(aRequest : TJSRequest; aOptions : TJSCacheDeleteOptions) : TJSPromise;
|
|
871
|
+
Function keys : TJSPromise; reintroduce;
|
|
872
|
+
Function match(aRequest : String): TJSPromise;
|
|
873
|
+
Function match(aRequest : TJSRequest): TJSPromise;
|
|
874
|
+
Function matchAll(aRequest : TJSStringDynArray): TJSPromise;
|
|
875
|
+
Function matchAll(aRequest : TJSRequestDynArray): TJSPromise;
|
|
876
|
+
Function matchAll(aRequests : TJSValueDynArray) : TJSPromise;
|
|
877
|
+
end;
|
|
878
|
+
|
|
879
|
+
TJSCacheStorage = class external name 'CacheStorage' (TJSObject)
|
|
880
|
+
Public
|
|
881
|
+
function delete(aName : string) : TJSPromise; // resolves to boolean
|
|
882
|
+
function has(aName : string) : TJSPromise;
|
|
883
|
+
Function keys : TJSPromise; reintroduce;
|
|
884
|
+
Function match(aRequest : String): TJSPromise;
|
|
885
|
+
Function match(aRequest : TJSRequest): TJSPromise;
|
|
886
|
+
function open(aName : string) : TJSPromise;
|
|
887
|
+
end;
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
{ ----------------------------------------------------------------------
|
|
891
|
+
Crypto
|
|
892
|
+
----------------------------------------------------------------------}
|
|
893
|
+
|
|
894
|
+
{ Basic types }
|
|
895
|
+
|
|
896
|
+
TJSCryptoAlgorithmIdentifier = JSValue;
|
|
897
|
+
TJSCryptoNamedCurve = JSValue;
|
|
898
|
+
TJSCryptoBigInteger = TJSUint8Array;
|
|
899
|
+
TJSCryptoKeyUsage = string;
|
|
900
|
+
TJSCryptoKeyType = string;
|
|
901
|
+
TJSCryptoKeyFormat = string;
|
|
902
|
+
|
|
903
|
+
{ Algorithm }
|
|
904
|
+
|
|
905
|
+
TJSCryptoAlgorithm = record
|
|
906
|
+
name : String;
|
|
907
|
+
end;
|
|
908
|
+
|
|
909
|
+
{ AesCbcParams }
|
|
910
|
+
|
|
911
|
+
TJSCryptoAesCbcParams = record
|
|
912
|
+
iv : TJSBufferSource;
|
|
913
|
+
end;
|
|
914
|
+
|
|
915
|
+
{ AesCtrParams }
|
|
916
|
+
|
|
917
|
+
TJSCryptoAesCtrParams = record
|
|
918
|
+
counter : TJSBufferSource;
|
|
919
|
+
length_ : Byte;external name 'length';
|
|
920
|
+
end;
|
|
921
|
+
|
|
922
|
+
{ AesGcmParams }
|
|
923
|
+
|
|
924
|
+
TJSCryptoAesGcmParams = record
|
|
925
|
+
iv : TJSBufferSource;
|
|
926
|
+
additionalData : TJSBufferSource;
|
|
927
|
+
tagLength : Byte;
|
|
928
|
+
end;
|
|
929
|
+
|
|
930
|
+
{ HmacImportParams }
|
|
931
|
+
|
|
932
|
+
TJSCryptoHmacImportParams = record
|
|
933
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
934
|
+
end;
|
|
935
|
+
|
|
936
|
+
{ Pbkdf2Params }
|
|
937
|
+
|
|
938
|
+
TJSCryptoPbkdf2Params = record
|
|
939
|
+
salt : TJSBufferSource;
|
|
940
|
+
iterations : NativeInt;
|
|
941
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
942
|
+
end;
|
|
943
|
+
|
|
944
|
+
{ RsaHashedImportParams }
|
|
945
|
+
|
|
946
|
+
TJSCryptoRsaHashedImportParams = record
|
|
947
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
948
|
+
end;
|
|
949
|
+
|
|
950
|
+
{ AesKeyGenParams }
|
|
951
|
+
|
|
952
|
+
TJSCryptoAesKeyGenParams = record
|
|
953
|
+
length_ : Integer;external name 'length';
|
|
954
|
+
end;
|
|
955
|
+
|
|
956
|
+
{ HmacKeyGenParams }
|
|
957
|
+
|
|
958
|
+
TJSCryptoHmacKeyGenParams = record
|
|
959
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
960
|
+
length_ : Integer;external name 'length';
|
|
961
|
+
end;
|
|
962
|
+
|
|
963
|
+
{ RsaHashedKeyGenParams }
|
|
964
|
+
|
|
965
|
+
TJSCryptoRsaHashedKeyGenParams = record
|
|
966
|
+
modulusLength : Integer;
|
|
967
|
+
publicExponent : TJSCryptoBigInteger;
|
|
968
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
969
|
+
end;
|
|
970
|
+
|
|
971
|
+
{ RsaOaepParams }
|
|
972
|
+
|
|
973
|
+
TJSCryptoRsaOaepParams = record
|
|
974
|
+
label_ : TJSBufferSource;external name 'label';
|
|
975
|
+
end;
|
|
976
|
+
|
|
977
|
+
{ RsaPssParams }
|
|
978
|
+
|
|
979
|
+
TJSCryptoRsaPssParams = record
|
|
980
|
+
saltLength : Integer;
|
|
981
|
+
end;
|
|
982
|
+
|
|
983
|
+
{ DhKeyGenParams }
|
|
984
|
+
|
|
985
|
+
TJSCryptoDhKeyGenParams = record
|
|
986
|
+
prime : TJSCryptoBigInteger;
|
|
987
|
+
generator : TJSCryptoBigInteger;
|
|
988
|
+
end;
|
|
989
|
+
|
|
990
|
+
{ EcKeyGenParams }
|
|
991
|
+
|
|
992
|
+
TJSCryptoEcKeyGenParams = record
|
|
993
|
+
_namedCurve : TJSCryptoNamedCurve;external name 'namedCurve';
|
|
994
|
+
end;
|
|
995
|
+
|
|
996
|
+
{ AesDerivedKeyParams }
|
|
997
|
+
|
|
998
|
+
TJSCryptoAesDerivedKeyParams = record
|
|
999
|
+
length_ : Integer;external name 'length';
|
|
1000
|
+
end;
|
|
1001
|
+
|
|
1002
|
+
{ HmacDerivedKeyParams }
|
|
1003
|
+
|
|
1004
|
+
TJSCryptoHmacDerivedKeyParams = record
|
|
1005
|
+
length_ : Integer;external name 'length';
|
|
1006
|
+
end;
|
|
1007
|
+
|
|
1008
|
+
{ EcdhKeyDeriveParams }
|
|
1009
|
+
|
|
1010
|
+
TJSCryptoEcdhKeyDeriveParams = record
|
|
1011
|
+
public_ : TJSCryptoKey; external name 'public';
|
|
1012
|
+
end;
|
|
1013
|
+
|
|
1014
|
+
{ DhKeyDeriveParams }
|
|
1015
|
+
|
|
1016
|
+
TJSCryptoDhKeyDeriveParams = record
|
|
1017
|
+
public_ : TJSCryptoKey; external name 'public';
|
|
1018
|
+
end;
|
|
1019
|
+
|
|
1020
|
+
{ DhImportKeyParams }
|
|
1021
|
+
|
|
1022
|
+
TJSCryptoDhImportKeyParams = record
|
|
1023
|
+
prime : TJSCryptoBigInteger;
|
|
1024
|
+
generator : TJSCryptoBigInteger;
|
|
1025
|
+
end;
|
|
1026
|
+
|
|
1027
|
+
{ EcdsaParams }
|
|
1028
|
+
|
|
1029
|
+
TJSCryptoEcdsaParams = record
|
|
1030
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
1031
|
+
end;
|
|
1032
|
+
|
|
1033
|
+
{ EcKeyImportParams }
|
|
1034
|
+
|
|
1035
|
+
TJSCryptoEcKeyImportParams = record
|
|
1036
|
+
_namedCurve : TJSCryptoNamedCurve;external name 'namedCurve';
|
|
1037
|
+
end;
|
|
1038
|
+
|
|
1039
|
+
{ HkdfParams }
|
|
1040
|
+
|
|
1041
|
+
TJSCryptoHkdfParams = record
|
|
1042
|
+
hash : TJSCryptoAlgorithmIdentifier;
|
|
1043
|
+
salt : TJSBufferSource;
|
|
1044
|
+
info : TJSBufferSource;
|
|
1045
|
+
end;
|
|
1046
|
+
|
|
1047
|
+
{ RsaOtherPrimesInfo }
|
|
1048
|
+
|
|
1049
|
+
TJSCryptoRsaOtherPrimesInfo = record
|
|
1050
|
+
r : String;
|
|
1051
|
+
d : String;
|
|
1052
|
+
t : String;
|
|
1053
|
+
end;
|
|
1054
|
+
|
|
1055
|
+
{ JsonWebKey }
|
|
1056
|
+
|
|
1057
|
+
TJSCryptoRsaOtherPrimesInfoDynArray = Array of TJSCryptoRsaOtherPrimesInfo;
|
|
1058
|
+
TJSCryptoJsonWebKey = record
|
|
1059
|
+
kty : String;
|
|
1060
|
+
use : String;
|
|
1061
|
+
key_ops : TStringDynArray;
|
|
1062
|
+
alg : String;
|
|
1063
|
+
ext : boolean;
|
|
1064
|
+
crv : String;
|
|
1065
|
+
x : String;
|
|
1066
|
+
y : String;
|
|
1067
|
+
d : String;
|
|
1068
|
+
n : String;
|
|
1069
|
+
e : String;
|
|
1070
|
+
p : String;
|
|
1071
|
+
q : String;
|
|
1072
|
+
dp : String;
|
|
1073
|
+
dq : String;
|
|
1074
|
+
qi : String;
|
|
1075
|
+
oth : TJSCryptoRsaOtherPrimesInfoDynArray;
|
|
1076
|
+
k : String;
|
|
1077
|
+
end;
|
|
1078
|
+
|
|
1079
|
+
{ CryptoKeyPair }
|
|
1080
|
+
|
|
1081
|
+
TJSCryptoKeyPair = record
|
|
1082
|
+
publicKey : TJSCryptoKey;
|
|
1083
|
+
privateKey : TJSCryptoKey;
|
|
1084
|
+
end;
|
|
1085
|
+
|
|
1086
|
+
{ TJSCryptoKey }
|
|
1087
|
+
|
|
1088
|
+
TJSCryptoKeyUsageDynArray = Array of TJSCryptoKeyUsage;
|
|
1089
|
+
TJSCryptoKey = class external name 'CryptoKey' (TJSObject)
|
|
1090
|
+
Private
|
|
1091
|
+
Ftype_ : TJSCryptoKeyType; external name 'type';
|
|
1092
|
+
Fextractable : boolean; external name 'extractable';
|
|
1093
|
+
Falgorithm : TJSObject; external name 'algorithm';
|
|
1094
|
+
Fusages : TJSCryptoKeyUsageDynArray; external name 'usages';
|
|
1095
|
+
Public
|
|
1096
|
+
Property type_ : TJSCryptoKeyType Read Ftype_;
|
|
1097
|
+
Property extractable : boolean Read Fextractable;
|
|
1098
|
+
Property algorithm : TJSObject Read Falgorithm;
|
|
1099
|
+
Property usages : TJSCryptoKeyUsageDynArray Read Fusages;
|
|
1100
|
+
end;
|
|
1101
|
+
|
|
1102
|
+
{ TJSSubtleCrypto }
|
|
1103
|
+
|
|
1104
|
+
TJSSubtleCrypto = class external name 'SubtleCrypto'
|
|
1105
|
+
Private
|
|
1106
|
+
Public
|
|
1107
|
+
function encrypt(algorithm : TJSCryptoAlgorithmIdentifier; key : TJSCryptoKey; data : TJSBufferSource): TJSArrayBuffer; async;
|
|
1108
|
+
function decrypt(algorithm : TJSCryptoAlgorithmIdentifier; key : TJSCryptoKey; data : TJSBufferSource): TJSArrayBuffer; async;
|
|
1109
|
+
function sign(algorithm : TJSCryptoAlgorithmIdentifier; key : TJSCryptoKey; data : TJSBufferSource): TJSArrayBuffer; async;
|
|
1110
|
+
function verify(algorithm : TJSCryptoAlgorithmIdentifier; key : TJSCryptoKey; signature : TJSBufferSource; data : TJSBufferSource): Boolean; async;
|
|
1111
|
+
function digest(algorithm : TJSCryptoAlgorithmIdentifier; data : TJSBufferSource): TJSArrayBuffer; async;
|
|
1112
|
+
function generateKey(algorithm : TJSCryptoAlgorithmIdentifier; extractable : boolean; keyUsages : TJSCryptoKeyUsageDynArray): TJSPromise;
|
|
1113
|
+
function deriveKey(algorithm : TJSCryptoAlgorithmIdentifier; baseKey : TJSCryptoKey; derivedKeyType : TJSCryptoAlgorithmIdentifier; extractable : boolean; keyUsages : TJSCryptoKeyUsageDynArray): TJSCryptoKey; async;
|
|
1114
|
+
function deriveBits(algorithm : TJSCryptoAlgorithmIdentifier; baseKey : TJSCryptoKey; length_ : NativeInt): TJSArrayBuffer; async;
|
|
1115
|
+
function importKey(format : TJSCryptoKeyFormat; keyData : TJSObject; algorithm : TJSCryptoAlgorithmIdentifier; extractable : boolean; keyUsages : TJSCryptoKeyUsageDynArray): TJSCryptoKey; async;
|
|
1116
|
+
function exportKey(format : TJSCryptoKeyFormat; key : TJSCryptoKey): TJSPromise;
|
|
1117
|
+
function wrapKey(format : TJSCryptoKeyFormat; key : TJSCryptoKey; wrappingKey : TJSCryptoKey; wrapAlgorithm : TJSCryptoAlgorithmIdentifier): TJSArrayBuffer; async;
|
|
1118
|
+
function unwrapKey(format : TJSCryptoKeyFormat; wrappedKey : TJSBufferSource; unwrappingKey : TJSCryptoKey; unwrapAlgorithm : TJSCryptoAlgorithmIdentifier; unwrappedKeyAlgorithm : TJSCryptoAlgorithmIdentifier; extractable : boolean; keyUsages : TJSCryptoKeyUsageDynArray): TJSCryptoKey; async;
|
|
1119
|
+
end;
|
|
1120
|
+
|
|
1121
|
+
{ TJSCrypto }
|
|
1122
|
+
|
|
1123
|
+
TJSCrypto = class external name 'Crypto' (TJSObject)
|
|
1124
|
+
private
|
|
1125
|
+
Fsubtle: TJSSubtleCrypto; external name 'subtle';
|
|
1126
|
+
Public
|
|
1127
|
+
function getRandomValues (anArray : TJSTypedArray) : TJSTypedArray;
|
|
1128
|
+
property subtle : TJSSubtleCrypto Read Fsubtle;
|
|
1129
|
+
end;
|
|
1130
|
+
|
|
1131
|
+
TJSEventSourceOptions = class external name 'Object' (TJSObject)
|
|
1132
|
+
withCredentials: boolean;
|
|
1133
|
+
end;
|
|
1134
|
+
|
|
1135
|
+
TJSEventSource = class external name 'EventSource' (TJSEventTarget)
|
|
1136
|
+
Private
|
|
1137
|
+
FReadyState : Integer; external name 'readyState';
|
|
1138
|
+
fURL : String; external name 'url';
|
|
1139
|
+
fwithCredentials : Boolean; external name 'withCredentials';
|
|
1140
|
+
Public
|
|
1141
|
+
constructor new(aURL : String);
|
|
1142
|
+
constructor new(aURL : String; options: TJSEventSourceOptions);
|
|
1143
|
+
procedure close;
|
|
1144
|
+
property readyState : Integer Read FReadyState;
|
|
1145
|
+
property url : String Read fURL;
|
|
1146
|
+
property withCredentials: boolean Read FwithCredentials;
|
|
1147
|
+
end;
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
{ ----------------------------------------------------------------------
|
|
1151
|
+
Service Worker
|
|
1152
|
+
----------------------------------------------------------------------}
|
|
1153
|
+
|
|
1154
|
+
{ TJSNavigationPreload }
|
|
1155
|
+
|
|
1156
|
+
TJSNavigationPreload = class external name 'navigationPreload' (TJSObject)
|
|
1157
|
+
public
|
|
1158
|
+
function enable: boolean; async;
|
|
1159
|
+
function disable: boolean; async;
|
|
1160
|
+
function setHeaderValue(Value: string): TJSPromise;
|
|
1161
|
+
function getState: TJSNavigationPreloadState; async;
|
|
1162
|
+
end;
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
TJSWorker = class external name 'Worker' (TJSEventTarget)
|
|
1166
|
+
public
|
|
1167
|
+
constructor new(aURL : string);
|
|
1168
|
+
procedure terminate;
|
|
1169
|
+
procedure postMessage(aValue : JSValue);
|
|
1170
|
+
procedure postMessage(aValue : JSValue; aList : TJSValueDynArray);
|
|
1171
|
+
end;
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
{ TJSServiceWorkerRegistration }
|
|
1175
|
+
|
|
1176
|
+
TJSServiceWorkerRegistration = class external name 'ServiceWorkerRegistration' (TJSObject)
|
|
1177
|
+
private
|
|
1178
|
+
FActive: TJSServiceWorker; external name 'active';
|
|
1179
|
+
FInstalling: TJSServiceWorker; external name 'installing';
|
|
1180
|
+
FScope: string; external name 'scope';
|
|
1181
|
+
FWaiting: TJSServiceWorker; external name 'waiting';
|
|
1182
|
+
FNavigationPreload: TJSNavigationPreload; external name 'navigationPreload';
|
|
1183
|
+
public
|
|
1184
|
+
function unregister : TJSPromise;
|
|
1185
|
+
procedure update;
|
|
1186
|
+
function showNotification(title : String; options : TJSNotificationOptions): TJSPromise; overload;
|
|
1187
|
+
function showNotification(title : String): TJSPromise; overload;
|
|
1188
|
+
function getNotifications(filter : TJSGetNotificationOptions): TJSPromise; overload;
|
|
1189
|
+
function getNotifications: TJSPromise; overload;
|
|
1190
|
+
property Active : TJSServiceWorker read FActive;
|
|
1191
|
+
property Scope : string read FScope;
|
|
1192
|
+
property Waiting : TJSServiceWorker read FWaiting;
|
|
1193
|
+
property Installing : TJSServiceWorker read FInstalling;
|
|
1194
|
+
property NavigationPreload: TJSNavigationPreload read FNavigationPreload;
|
|
1195
|
+
end;
|
|
1196
|
+
|
|
1197
|
+
{ TJSServiceWorker }
|
|
1198
|
+
|
|
1199
|
+
TJSServiceWorker = class external name 'ServiceWorker' (TJSWorker)
|
|
1200
|
+
private
|
|
1201
|
+
FRegistration: TJSServiceWorkerRegistration; external name 'registration';
|
|
1202
|
+
FScriptURL: String; external name 'scriptURL';
|
|
1203
|
+
FState: string; external name 'state';
|
|
1204
|
+
Public
|
|
1205
|
+
property State : string read FState;
|
|
1206
|
+
property ScriptURL : String Read FscriptURL;
|
|
1207
|
+
property Registration: TJSServiceWorkerRegistration read FRegistration;
|
|
1208
|
+
end;
|
|
1209
|
+
|
|
1210
|
+
TOnChangeProcedure = reference to procedure;
|
|
1211
|
+
|
|
1212
|
+
TJSPermissionDescriptor = class external name 'Object' (TJSObject)
|
|
1213
|
+
public
|
|
1214
|
+
name: String;
|
|
1215
|
+
userVisibleOnly: Boolean;
|
|
1216
|
+
sysex: Boolean;
|
|
1217
|
+
end;
|
|
1218
|
+
|
|
1219
|
+
TJSPermissionStatus = class external name 'PermissionStatus' (TJSObject)
|
|
1220
|
+
private
|
|
1221
|
+
FState: String; external name 'state';
|
|
1222
|
+
public
|
|
1223
|
+
onchange: TOnChangeProcedure;
|
|
1224
|
+
property state: String read FState;
|
|
1225
|
+
end;
|
|
1226
|
+
|
|
1227
|
+
TJSPermissions = class external name 'Permissions' (TJSObject)
|
|
1228
|
+
public
|
|
1229
|
+
function query(descriptor: TJSPermissionDescriptor): TJSPermissionStatus; async;
|
|
1230
|
+
end;
|
|
1231
|
+
|
|
1232
|
+
TJSFileSystemHandlePermissionDescriptor = class external name 'Object' (TJSObject)
|
|
1233
|
+
public
|
|
1234
|
+
mode: String;
|
|
1235
|
+
end;
|
|
1236
|
+
|
|
1237
|
+
// Union of BufferSource, Blob, USVString, WriteParams
|
|
1238
|
+
TJSFileSystemWriteChunkType = JSValue;
|
|
1239
|
+
|
|
1240
|
+
{ --------------------------------------------------------------------
|
|
1241
|
+
FileSystemCreateWritableOptions
|
|
1242
|
+
--------------------------------------------------------------------}
|
|
1243
|
+
|
|
1244
|
+
TJSFileSystemCreateWritableOptions = record
|
|
1245
|
+
keepExistingData: Boolean;
|
|
1246
|
+
end;
|
|
1247
|
+
|
|
1248
|
+
{ --------------------------------------------------------------------
|
|
1249
|
+
FileSystemGetFileOptions
|
|
1250
|
+
--------------------------------------------------------------------}
|
|
1251
|
+
|
|
1252
|
+
TJSFileSystemGetFileOptions = record
|
|
1253
|
+
create: Boolean;
|
|
1254
|
+
end;
|
|
1255
|
+
|
|
1256
|
+
{ --------------------------------------------------------------------
|
|
1257
|
+
FileSystemGetDirectoryOptions
|
|
1258
|
+
--------------------------------------------------------------------}
|
|
1259
|
+
|
|
1260
|
+
TJSFileSystemGetDirectoryOptions = record
|
|
1261
|
+
create: Boolean;
|
|
1262
|
+
end;
|
|
1263
|
+
|
|
1264
|
+
{ --------------------------------------------------------------------
|
|
1265
|
+
FileSystemRemoveOptions
|
|
1266
|
+
--------------------------------------------------------------------}
|
|
1267
|
+
|
|
1268
|
+
TJSFileSystemRemoveOptions = record
|
|
1269
|
+
recursive: Boolean;
|
|
1270
|
+
end;
|
|
1271
|
+
|
|
1272
|
+
{ --------------------------------------------------------------------
|
|
1273
|
+
WriteParams
|
|
1274
|
+
--------------------------------------------------------------------}
|
|
1275
|
+
|
|
1276
|
+
TJSWriteParams = record
|
|
1277
|
+
type_: TWriteCommandType;external name 'type';
|
|
1278
|
+
size: NativeInt;
|
|
1279
|
+
position: NativeInt;
|
|
1280
|
+
data: JSValue;
|
|
1281
|
+
end;
|
|
1282
|
+
|
|
1283
|
+
{ --------------------------------------------------------------------
|
|
1284
|
+
FileSystemReadWriteOptions
|
|
1285
|
+
--------------------------------------------------------------------}
|
|
1286
|
+
|
|
1287
|
+
TJSFileSystemReadWriteOptions = record
|
|
1288
|
+
at: NativeInt;
|
|
1289
|
+
end;
|
|
1290
|
+
|
|
1291
|
+
{ --------------------------------------------------------------------
|
|
1292
|
+
TJSWritableStream
|
|
1293
|
+
--------------------------------------------------------------------}
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
{ --------------------------------------------------------------------
|
|
1297
|
+
TJSFileSystemHandle
|
|
1298
|
+
--------------------------------------------------------------------}
|
|
1299
|
+
TJSBooleanPromise = specialize TGPromise<boolean>;
|
|
1300
|
+
TJSValuePromise = specialize TGPromise<JSValue>;
|
|
1301
|
+
TJSUndefinedPromise = TJSValuePromise;
|
|
1302
|
+
TJSFilePromise = specialize TGPromise<TJSFile>;
|
|
1303
|
+
|
|
1304
|
+
TJSFileSystemHandle = class external name 'FileSystemHandle'
|
|
1305
|
+
Private
|
|
1306
|
+
Fkind: TFileSystemHandleKind; external name 'kind';
|
|
1307
|
+
Fname: String; external name 'name';
|
|
1308
|
+
Public
|
|
1309
|
+
function isSameEntry(aOther: TJSFileSystemHandle): TJSBooleanPromise;
|
|
1310
|
+
Property kind: TFileSystemHandleKind Read Fkind;
|
|
1311
|
+
Property name: String Read Fname;
|
|
1312
|
+
end;
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
{ --------------------------------------------------------------------
|
|
1316
|
+
TJSFileSystemSyncAccessHandle
|
|
1317
|
+
--------------------------------------------------------------------}
|
|
1318
|
+
|
|
1319
|
+
TJSFileSystemSyncAccessHandle = class external name 'FileSystemSyncAccessHandle'
|
|
1320
|
+
Private
|
|
1321
|
+
Public
|
|
1322
|
+
function read(aBuffer: TJSBufferSource; const aOptions: TJSFileSystemReadWriteOptions): NativeInt; overload;
|
|
1323
|
+
function read(aBuffer: TJSBufferSource): NativeInt; overload;
|
|
1324
|
+
function write(aBuffer: TJSBufferSource; const aOptions: TJSFileSystemReadWriteOptions): NativeInt; overload;
|
|
1325
|
+
function write(aBuffer: TJSBufferSource): NativeInt; overload;
|
|
1326
|
+
function truncate(aNewSize: NativeInt): TJSUndefinedPromise;
|
|
1327
|
+
function getSize: NativeInt;
|
|
1328
|
+
function flush: TJSUndefinedPromise;
|
|
1329
|
+
function close: TJSUndefinedPromise;
|
|
1330
|
+
end;
|
|
1331
|
+
|
|
1332
|
+
{ --------------------------------------------------------------------
|
|
1333
|
+
TJSFileSystemFileHandle
|
|
1334
|
+
--------------------------------------------------------------------}
|
|
1335
|
+
TJSFileSystemWritableFileStreamPromise = specialize TGPromise<TJSFileSystemWritableFileStream>;
|
|
1336
|
+
TJSFileSystemSyncAccessHandlePromise = specialize TGPromise<TJSFileSystemSyncAccessHandle>;
|
|
1337
|
+
|
|
1338
|
+
TJSFileSystemFileHandle = class external name 'FileSystemFileHandle' (TJSFileSystemHandle)
|
|
1339
|
+
Private
|
|
1340
|
+
Public
|
|
1341
|
+
function getFile: TJSFilePromise;
|
|
1342
|
+
function createWritable(const aOptions: TJSFileSystemCreateWritableOptions): TJSFileSystemWritableFileStreamPromise; overload;
|
|
1343
|
+
function createWritable: TJSFileSystemWritableFileStreamPromise; overload;
|
|
1344
|
+
function createSyncAccessHandle: TJSFileSystemSyncAccessHandlePromise;
|
|
1345
|
+
end;
|
|
1346
|
+
|
|
1347
|
+
{ --------------------------------------------------------------------
|
|
1348
|
+
TJSFileSystemDirectoryHandle
|
|
1349
|
+
--------------------------------------------------------------------}
|
|
1350
|
+
TJSFileSystemFileHandlePromise = specialize TGPromise<TJSFileSystemFileHandle>;
|
|
1351
|
+
TJSStringDynArrayPromise = specialize TGPromise<TStringDynArray>;
|
|
1352
|
+
TJSFileSystemDirectoryHandlePromise = specialize TGPromise<TJSFileSystemDirectoryHandle>;
|
|
1353
|
+
|
|
1354
|
+
TJSFileSystemDirectoryHandle = class external name 'FileSystemDirectoryHandle' (TJSFileSystemHandle)
|
|
1355
|
+
Private
|
|
1356
|
+
Public
|
|
1357
|
+
function getFileHandle(aName: String; const aOptions: TJSFileSystemGetFileOptions): TJSFileSystemFileHandlePromise; overload;
|
|
1358
|
+
function getFileHandle(aName: String): TJSFileSystemFileHandlePromise; overload;
|
|
1359
|
+
function getDirectoryHandle(aName: String; const aOptions: TJSFileSystemGetDirectoryOptions): TJSFileSystemDirectoryHandlePromise; overload;
|
|
1360
|
+
function getDirectoryHandle(aName: String): TJSFileSystemDirectoryHandlePromise; overload;
|
|
1361
|
+
function removeEntry(aName: String; const aOptions: TJSFileSystemRemoveOptions): TJSUndefinedPromise; overload;
|
|
1362
|
+
function removeEntry(aName: String): TJSUndefinedPromise; overload;
|
|
1363
|
+
function resolve(aPossibleDescendant: TJSFileSystemHandle): TJSStringDynArrayPromise;
|
|
1364
|
+
function entries: TJSObject;
|
|
1365
|
+
function values : TJSObject;
|
|
1366
|
+
end;
|
|
1367
|
+
|
|
1368
|
+
{ --------------------------------------------------------------------
|
|
1369
|
+
TJSFileSystemWritableFileStream
|
|
1370
|
+
--------------------------------------------------------------------}
|
|
1371
|
+
|
|
1372
|
+
TJSFileSystemWritableFileStream = class external name 'FileSystemWritableFileStream' (TJSWritableStream)
|
|
1373
|
+
Private
|
|
1374
|
+
Public
|
|
1375
|
+
function write(aData: TJSFileSystemWriteChunkType): TJSUndefinedPromise;
|
|
1376
|
+
function seek(aPosition: NativeInt): TJSUndefinedPromise;
|
|
1377
|
+
function truncate(aSize: NativeInt): TJSUndefinedPromise;
|
|
1378
|
+
end;
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
TJSDirectoryPromise = specialize TGPromise<TJSFileSystemDirectoryHandle>;
|
|
1382
|
+
TJSStorageManager = class external name 'StorageManager' (TJSObject)
|
|
1383
|
+
function estimate : TJSPromise;
|
|
1384
|
+
function persist : TJSPromise;
|
|
1385
|
+
function persisted : TJSPromise;
|
|
1386
|
+
function GetDirectory : TJSDirectoryPromise;
|
|
1387
|
+
end;
|
|
1388
|
+
|
|
1389
|
+
TJSMicrotaskProcedure = reference to Procedure;
|
|
1390
|
+
|
|
1391
|
+
TJSImageBitmapOptions = class external name 'Object' (TJSObject)
|
|
1392
|
+
imageOrientation : string;
|
|
1393
|
+
premultiplyAlpha : string;
|
|
1394
|
+
colorSpaceConversion : String;
|
|
1395
|
+
resizeWidth : NativeInt;
|
|
1396
|
+
resizeHeight : NativeInt;
|
|
1397
|
+
resizeQuality : String;
|
|
1398
|
+
end;
|
|
1399
|
+
|
|
1400
|
+
TJSEventCountsMap = class external name 'EventCounts' (TJSMap)
|
|
1401
|
+
end;
|
|
1402
|
+
|
|
1403
|
+
TJSDOMHighResTimeStamp = Double;
|
|
1404
|
+
|
|
1405
|
+
{ TJSPerformanceEntry }
|
|
1406
|
+
|
|
1407
|
+
TJSPerformanceEntry = class external name 'PerformanceEntry' (TJSObject)
|
|
1408
|
+
private
|
|
1409
|
+
FDuration: TJSDOMHighResTimeStamp; external name 'duration';
|
|
1410
|
+
FEntryType: string; external name 'entryType';
|
|
1411
|
+
FName: string; external name 'name';
|
|
1412
|
+
FStartTime: TJSDOMHighResTimeStamp; external name 'startTime';
|
|
1413
|
+
Public
|
|
1414
|
+
Property Duration : TJSDOMHighResTimeStamp Read FDuration;
|
|
1415
|
+
Property EntryType : string Read FEntryType;
|
|
1416
|
+
Property Name : string Read FName;
|
|
1417
|
+
Property StartTime : TJSDOMHighResTimeStamp Read FStartTime;
|
|
1418
|
+
end;
|
|
1419
|
+
TJSPerformanceEntryArray = Array of TJSPerformanceEntry;
|
|
1420
|
+
|
|
1421
|
+
TJSPerformanceMarkOptions = class external name 'Object' (TJSObject)
|
|
1422
|
+
detail : JSValue;
|
|
1423
|
+
startTime: TJSDOMHighResTimeStamp;
|
|
1424
|
+
end;
|
|
1425
|
+
|
|
1426
|
+
TJSPerformanceMeasureOptions = class external name 'Object' (TJSObject)
|
|
1427
|
+
detail : JSValue;
|
|
1428
|
+
startTime: TJSDOMHighResTimeStamp;
|
|
1429
|
+
duration: TJSDOMHighResTimeStamp;
|
|
1430
|
+
end_: TJSDOMHighResTimeStamp; external name 'end';
|
|
1431
|
+
end;
|
|
1432
|
+
|
|
1433
|
+
TJSPerformance = class external name 'Performance' (TJSObject)
|
|
1434
|
+
Private
|
|
1435
|
+
FEventCounts : TJSEventCountsMap; external name 'eventcounts';
|
|
1436
|
+
FTimeOrigin : TJSDOMHighResTimeStamp; external name 'timeOrigin';
|
|
1437
|
+
public
|
|
1438
|
+
procedure clearMarks; overload;
|
|
1439
|
+
procedure clearMarks(aName : String); overload;
|
|
1440
|
+
procedure clearMeasures; overload;
|
|
1441
|
+
procedure clearMeasures(aName : String); overload;
|
|
1442
|
+
procedure clearResourceTimings; overload;
|
|
1443
|
+
function getEntries : TJSPerformanceEntryArray;
|
|
1444
|
+
function getEntriesByName(aName : string) : TJSPerformanceEntryArray;
|
|
1445
|
+
function getEntriesByName(aName,aType : string) : TJSPerformanceEntryArray;
|
|
1446
|
+
function getEntriesByType(aType : string) : TJSPerformanceEntryArray;
|
|
1447
|
+
procedure mark(aName : String); overload;
|
|
1448
|
+
procedure mark(aName : String; aOptions : TJSObject); overload;
|
|
1449
|
+
procedure mark(aName : String; aOptions : TJSPerformanceMarkOptions); overload;
|
|
1450
|
+
procedure measure(aName : String); overload;
|
|
1451
|
+
procedure measure(aName, aStartmark : String); overload;
|
|
1452
|
+
procedure measure(aName, aStartmark, aEndMark : String); overload;
|
|
1453
|
+
procedure measure(aName : String; aOptions : TJSObject); overload;
|
|
1454
|
+
procedure measure(aName : String; aOptions : TJSPerformanceMeasureOptions); overload;
|
|
1455
|
+
procedure measure(aName : String; aOptions : TJSObject; aEndMark : string); overload;
|
|
1456
|
+
procedure measure(aName : String; aOptions : TJSPerformanceMeasureOptions; aEndMark : string); overload;
|
|
1457
|
+
function now : TJSDOMHighResTimeStamp;
|
|
1458
|
+
function toJSON : TJSObject;
|
|
1459
|
+
procedure setResourceTimingBufferSize(aMaxSize : NativeInt);
|
|
1460
|
+
property eventCounts : TJSEventCountsMap read FEventCounts;
|
|
1461
|
+
property timeOrigin : TJSDOMHighResTimeStamp Read FTimeOrigin;
|
|
1462
|
+
end;
|
|
1463
|
+
|
|
1464
|
+
{ TWindowOrWorkerGlobalScope }
|
|
1465
|
+
|
|
1466
|
+
TWindowOrWorkerGlobalScope = Class external name 'Object' (TJSEventTarget)
|
|
1467
|
+
Private
|
|
1468
|
+
FCrypto: TJSCrypto; external name 'crypto';
|
|
1469
|
+
FisSecureContext : boolean; external name 'isSecureContext';
|
|
1470
|
+
FIDBFactory : TJSIDBFactory; external name 'indexedDB';
|
|
1471
|
+
fcaches : TJSCacheStorage; external name 'caches';
|
|
1472
|
+
FPerformance : TJSPerformance; external name 'performance';
|
|
1473
|
+
Public
|
|
1474
|
+
Function atob(Const aValue : string) : string;
|
|
1475
|
+
Function btoa(Const aValue : string) : string;
|
|
1476
|
+
Function setInterval(ahandler : TJSTimerCallBack; aInterval : NativeUInt) : NativeInt; varargs;
|
|
1477
|
+
Function setTimeout(ahandler : TJSTimerCallBack; aTimeout : NativeUInt) : NativeInt; varargs;
|
|
1478
|
+
Function setTimeout(ahandler : TJSTimerCallBack) : NativeInt;
|
|
1479
|
+
Procedure clearInterval(aID: NativeInt); overload;
|
|
1480
|
+
Procedure clearTimeout(aID: NativeInt); overload;
|
|
1481
|
+
procedure queueMicrotask(callback : TJSMicrotaskProcedure);
|
|
1482
|
+
Function createImageBitmap(Source : JSValue) : TJSPromise;
|
|
1483
|
+
Function createImageBitmap(Source : JSValue; aOptions : TJSImageBitmapOptions) : TJSPromise;
|
|
1484
|
+
Function createImageBitmap(Source : JSValue; sx,sy,sw,sh : NativeInt; aOptions : TJSImageBitmapOptions) : TJSPromise;
|
|
1485
|
+
Function structuredClone(value : JSValue) : JSValue;
|
|
1486
|
+
Function structuredClone(value : JSValue; aOptions : TJSStructuredSerializeOptions) : JSValue;
|
|
1487
|
+
function fetch(resource: String; init: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
1488
|
+
//function fetch(resource: String): TJSPromise; overload; external name 'fetch';
|
|
1489
|
+
function fetch(resource: String): TJSResponse; {$IFNDEF SkipAsync}async;{$ENDIF} overload; external name 'fetch';
|
|
1490
|
+
function fetch(resource: TJSObject; init: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
1491
|
+
function fetch(resource: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
1492
|
+
property Performance: TJSPerformance read FPerformance;
|
|
1493
|
+
property isSecureContext : Boolean Read FisSecureContext;
|
|
1494
|
+
property IDBFactory : TJSIDBFactory Read FIDBFactory;
|
|
1495
|
+
property caches : TJSCacheStorage read fcaches;
|
|
1496
|
+
property crypto : TJSCrypto Read FCrypto;
|
|
1497
|
+
end;
|
|
1498
|
+
|
|
1499
|
+
{ TJSAbortSignal }
|
|
1500
|
+
|
|
1501
|
+
TJSAbortSignal = class external name 'AbortSignal' (TJSEventTarget)
|
|
1502
|
+
private
|
|
1503
|
+
FAborted: Boolean; external name 'aborted';
|
|
1504
|
+
FReason: JSValue; external name 'reason';
|
|
1505
|
+
Public
|
|
1506
|
+
Class function abort : TJSAbortSignal;
|
|
1507
|
+
Class function any(iterable : TJSIterator) : TJSAbortSignal;
|
|
1508
|
+
Class function any(iterable : array of TJSAbortSignal) : TJSAbortSignal;
|
|
1509
|
+
Class function timeout(aTimeout : NativeInt) : TJSAbortSignal;
|
|
1510
|
+
procedure throwIfAborted;
|
|
1511
|
+
Property Aborted : Boolean Read FAborted;
|
|
1512
|
+
Property Reason : JSValue Read FReason;
|
|
1513
|
+
end;
|
|
1514
|
+
|
|
1515
|
+
{ TJSAbortController }
|
|
1516
|
+
|
|
1517
|
+
TJSAbortController = class external name 'AbortController' (TJSAbortSignal)
|
|
1518
|
+
private
|
|
1519
|
+
FSignal: TJSAbortSignal; external name 'signal';
|
|
1520
|
+
Public
|
|
1521
|
+
Procedure abort; reintroduce;
|
|
1522
|
+
Procedure abort(aReason : JSValue);
|
|
1523
|
+
Property signal : TJSAbortSignal Read FSignal;
|
|
1524
|
+
end;
|
|
1525
|
+
|
|
1526
|
+
{ --------------------------------------------------------------------
|
|
1527
|
+
TJSNotificationOptions
|
|
1528
|
+
--------------------------------------------------------------------}
|
|
1529
|
+
|
|
1530
|
+
TTJSNotificationActionDynArray = Array of TJSNotificationAction;
|
|
1531
|
+
TJSNotificationOptions = class external name 'Object' (TJSObject)
|
|
1532
|
+
dir : NotificationDirection;
|
|
1533
|
+
lang : String;
|
|
1534
|
+
body : String;
|
|
1535
|
+
tag : String;
|
|
1536
|
+
image : String;
|
|
1537
|
+
icon : String;
|
|
1538
|
+
badge : String;
|
|
1539
|
+
vibrate : TJSVibratePattern;
|
|
1540
|
+
timestamp : NativeInt;
|
|
1541
|
+
renotify : boolean;
|
|
1542
|
+
silent : boolean;
|
|
1543
|
+
requireInteraction : boolean;
|
|
1544
|
+
data : JSValue;
|
|
1545
|
+
actions : TTJSNotificationActionDynArray;
|
|
1546
|
+
end;
|
|
1547
|
+
|
|
1548
|
+
{ --------------------------------------------------------------------
|
|
1549
|
+
TJSNotificationAction
|
|
1550
|
+
--------------------------------------------------------------------}
|
|
1551
|
+
|
|
1552
|
+
TJSNotificationAction = class(TJSObject)
|
|
1553
|
+
action : String;
|
|
1554
|
+
title : String;
|
|
1555
|
+
icon : String;
|
|
1556
|
+
end;
|
|
1557
|
+
|
|
1558
|
+
{ --------------------------------------------------------------------
|
|
1559
|
+
TJSGetNotificationOptions
|
|
1560
|
+
--------------------------------------------------------------------}
|
|
1561
|
+
|
|
1562
|
+
TJSGetNotificationOptions = class(TJSObject)
|
|
1563
|
+
tag : String;
|
|
1564
|
+
end;
|
|
1565
|
+
|
|
1566
|
+
{ --------------------------------------------------------------------
|
|
1567
|
+
TJSNotificationEventInit
|
|
1568
|
+
--------------------------------------------------------------------}
|
|
1569
|
+
|
|
1570
|
+
TJSNotificationEventInit = class(TJSObject)
|
|
1571
|
+
notification : TJSNotification;
|
|
1572
|
+
action : String;
|
|
1573
|
+
end;
|
|
1574
|
+
|
|
1575
|
+
{ --------------------------------------------------------------------
|
|
1576
|
+
TJSNotification
|
|
1577
|
+
--------------------------------------------------------------------}
|
|
1578
|
+
|
|
1579
|
+
TNativeIntDynArray = Array of NativeInt;
|
|
1580
|
+
TJSNotification = class external name 'Notification' (TJSEventTarget)
|
|
1581
|
+
Private
|
|
1582
|
+
Fpermission : NotificationPermission; external name 'permission';
|
|
1583
|
+
FmaxActions : NativeInt; external name 'maxActions';
|
|
1584
|
+
Ftitle : String; external name 'title';
|
|
1585
|
+
Fdir : NotificationDirection; external name 'dir';
|
|
1586
|
+
Flang : String; external name 'lang';
|
|
1587
|
+
Fbody : String; external name 'body';
|
|
1588
|
+
Ftag : String; external name 'tag';
|
|
1589
|
+
Fimage : String; external name 'image';
|
|
1590
|
+
Ficon : String; external name 'icon';
|
|
1591
|
+
Fbadge : String; external name 'badge';
|
|
1592
|
+
Fvibrate : TNativeIntDynArray; external name 'vibrate';
|
|
1593
|
+
Ftimestamp : NativeInt; external name 'timestamp';
|
|
1594
|
+
Frenotify : boolean; external name 'renotify';
|
|
1595
|
+
Fsilent : boolean; external name 'silent';
|
|
1596
|
+
FrequireInteraction : boolean; external name 'requireInteraction';
|
|
1597
|
+
Fdata : JSValue; external name 'data';
|
|
1598
|
+
Factions : TTJSNotificationActionDynArray; external name 'actions';
|
|
1599
|
+
Public
|
|
1600
|
+
onclick : TJSEventHandler;
|
|
1601
|
+
onshow : TJSEventHandler;
|
|
1602
|
+
onerror : TJSEventHandler;
|
|
1603
|
+
onclose : TJSEventHandler;
|
|
1604
|
+
class function requestPermission(deprecatedCallback : NotificationPermissionCallback): TJSPromise; overload;
|
|
1605
|
+
class function requestPermission: TJSPromise; overload;
|
|
1606
|
+
constructor new (aTitle : String);
|
|
1607
|
+
constructor new (aTitle : String; Options : TJSObject);
|
|
1608
|
+
constructor new (aTitle : String; Options : TJSNotificationOptions);
|
|
1609
|
+
Procedure close;
|
|
1610
|
+
Property permission : NotificationPermission Read Fpermission;
|
|
1611
|
+
Property maxActions : NativeInt Read FmaxActions;
|
|
1612
|
+
Property title : String Read Ftitle;
|
|
1613
|
+
Property dir : NotificationDirection Read Fdir;
|
|
1614
|
+
Property lang : String Read Flang;
|
|
1615
|
+
Property body : String Read Fbody;
|
|
1616
|
+
Property tag : String Read Ftag;
|
|
1617
|
+
Property image : String Read Fimage;
|
|
1618
|
+
Property icon : String Read Ficon;
|
|
1619
|
+
Property badge : String Read Fbadge;
|
|
1620
|
+
Property vibrate : TNativeIntDynArray Read Fvibrate;
|
|
1621
|
+
Property timestamp : NativeInt Read Ftimestamp;
|
|
1622
|
+
Property renotify : boolean Read Frenotify;
|
|
1623
|
+
Property silent : boolean Read Fsilent;
|
|
1624
|
+
Property requireInteraction : boolean Read FrequireInteraction;
|
|
1625
|
+
Property data : JSValue Read Fdata;
|
|
1626
|
+
Property actions : TTJSNotificationActionDynArray Read Factions;
|
|
1627
|
+
end;
|
|
1628
|
+
|
|
1629
|
+
{ TJSBroadcastChannel }
|
|
1630
|
+
|
|
1631
|
+
TJSBroadcastChannel = class external name 'BroadcastChannel' (TJSEventTarget)
|
|
1632
|
+
private
|
|
1633
|
+
FName: string; external name 'name';
|
|
1634
|
+
public
|
|
1635
|
+
constructor new(aChannel : string);
|
|
1636
|
+
procedure postMessage(aValue : JSValue);
|
|
1637
|
+
procedure close;
|
|
1638
|
+
property name : string Read FName;
|
|
1639
|
+
end;
|
|
1640
|
+
|
|
1641
|
+
{ --------------------------------------------------------------------
|
|
1642
|
+
TJSNotificationEvent
|
|
1643
|
+
--------------------------------------------------------------------}
|
|
1644
|
+
|
|
1645
|
+
TJSNotificationEvent = class external name 'NotificationEvent' (TJSExtendableEvent)
|
|
1646
|
+
Private
|
|
1647
|
+
Fnotification : TJSNotification; external name 'notification';
|
|
1648
|
+
Faction : String; external name 'action';
|
|
1649
|
+
Public
|
|
1650
|
+
Property notification : TJSNotification Read Fnotification;
|
|
1651
|
+
Property action : String Read Faction;
|
|
1652
|
+
end;
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
TCanvasCoordType = double;
|
|
1656
|
+
{ TJSImageData }
|
|
1657
|
+
|
|
1658
|
+
TJSImageData = class external name 'ImageData' (TJSObject)
|
|
1659
|
+
private
|
|
1660
|
+
FData: TJSUint8ClampedArray; external name 'data';
|
|
1661
|
+
FHeight: Integer; external name 'height';
|
|
1662
|
+
FWidth: Integer; external name 'width';
|
|
1663
|
+
Public
|
|
1664
|
+
constructor new(awidth,aheight : integer); overload;
|
|
1665
|
+
constructor new(anArray :TJSUint8ClampedArray; awidth,aheight : integer); overload;
|
|
1666
|
+
property data : TJSUint8ClampedArray read FData;
|
|
1667
|
+
property height : Integer Read FHeight;
|
|
1668
|
+
property width : Integer Read FWidth;
|
|
1669
|
+
end;
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
TJSTextMetrics = class external name 'TextMetrics' (TJSObject)
|
|
1673
|
+
width : TCanvasCoordType;
|
|
1674
|
+
actualBoundingBoxLeft : TCanvasCoordType;
|
|
1675
|
+
actualBoundingBoxRight : TCanvasCoordType;
|
|
1676
|
+
fontBoundingBoxAscent : TCanvasCoordType;
|
|
1677
|
+
fontBoundingBoxDescent : TCanvasCoordType;
|
|
1678
|
+
actualBoundingBoxAscent : TCanvasCoordType;
|
|
1679
|
+
actualBoundingBoxDescent : TCanvasCoordType;
|
|
1680
|
+
emHeightAscent : TCanvasCoordType;
|
|
1681
|
+
emHeightDescent : TCanvasCoordType;
|
|
1682
|
+
hangingBaseline : TCanvasCoordType;
|
|
1683
|
+
alphabeticBaseline : TCanvasCoordType;
|
|
1684
|
+
ideographicBaseline : TCanvasCoordType;
|
|
1685
|
+
end;
|
|
1686
|
+
|
|
1687
|
+
// Opaque objects
|
|
1688
|
+
TJSCanvasGradient = class external name 'CanvasGradient' (TJSObject)
|
|
1689
|
+
procedure addColorStop(offset : double; aColor : string);
|
|
1690
|
+
end;
|
|
1691
|
+
|
|
1692
|
+
TJSCanvasPattern = class external name 'CanvasPattern' (TJSObject)
|
|
1693
|
+
end;
|
|
1694
|
+
|
|
1695
|
+
TJSPath2D = class external name 'Path2D' (TJSObject)
|
|
1696
|
+
Public
|
|
1697
|
+
constructor new; overload;
|
|
1698
|
+
constructor new(aPath : TJSPath2D); overload;
|
|
1699
|
+
constructor new(SVGPath : String); overload;
|
|
1700
|
+
Procedure addPath(aPath : TJSPath2D);
|
|
1701
|
+
procedure arc(x,y, radius,startAngle,endAngle : TCanvasCoordType); overload;
|
|
1702
|
+
procedure arc(x,y, radius,startAngle,endAngle : TCanvasCoordType; antiClockWise : boolean); overload;
|
|
1703
|
+
procedure arcTo(x1,y1,x2,y2,radius : TCanvasCoordType); overload;
|
|
1704
|
+
procedure bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y : TCanvasCoordType); overload;
|
|
1705
|
+
Procedure closePath;
|
|
1706
|
+
procedure ellipse(x, y, radiusX, radiusY : TCanvasCoordType; rotation, startAngle, endAngle : Double); overload;
|
|
1707
|
+
procedure ellipse(x, y, radiusX, radiusY : TCanvasCoordType; rotation, startAngle, endAngle : Double; anticlockwise : Boolean); overload;
|
|
1708
|
+
Procedure lineTo(X,Y : TCanvasCoordType);
|
|
1709
|
+
Procedure moveTo(X,Y : TCanvasCoordType);
|
|
1710
|
+
procedure quadraticCurveTo(cpx,cpy,x,y : TCanvasCoordType);
|
|
1711
|
+
procedure rect(x,y,awidth,aheight: TCanvasCoordType); overload;
|
|
1712
|
+
end;
|
|
1713
|
+
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
{ TJSCanvasRenderingContext2D }
|
|
1717
|
+
TJSBaseCanvasRenderingContext2D = class external name 'CanvasRenderingContext2D' (TJSObject)
|
|
1718
|
+
private
|
|
1719
|
+
FfillStyleColor: String; external name 'fillStyle';
|
|
1720
|
+
FfillStyleGradient: TJSCanvasGradient; external name 'fillStyle';
|
|
1721
|
+
FfillStylePattern: TJSCanvasPattern; external name 'fillStyle';
|
|
1722
|
+
FimageSmoothingEnabled: Boolean; external name 'imageSmoothingEnabled';
|
|
1723
|
+
FstrokeStyleColor: String; external name 'strokeStyle';
|
|
1724
|
+
FstrokeStyleGradient: TJSCanvasGradient; external name 'strokeStyle';
|
|
1725
|
+
FstrokeStylePattern: TJSCanvasPattern; external name 'strokeStyle';
|
|
1726
|
+
Public
|
|
1727
|
+
fillStyle : JSValue;
|
|
1728
|
+
filter : string;
|
|
1729
|
+
font : string;
|
|
1730
|
+
globalAlpha : double;
|
|
1731
|
+
globalCompositeOperation : String;
|
|
1732
|
+
lineCap : string;
|
|
1733
|
+
lineDashOffset : Double;
|
|
1734
|
+
lineJoin : String;
|
|
1735
|
+
lineWidth : Double;
|
|
1736
|
+
miterLimit : Double;
|
|
1737
|
+
shadowBlur : Double;
|
|
1738
|
+
shadowColor : String;
|
|
1739
|
+
shadowOffsetX : Double;
|
|
1740
|
+
shadowOffsetY : Double;
|
|
1741
|
+
strokeStyle : JSValue;
|
|
1742
|
+
textAlign : String;
|
|
1743
|
+
textBaseline : String;
|
|
1744
|
+
procedure arc(x,y, radius,startAngle,endAngle : TCanvasCoordType); overload;
|
|
1745
|
+
procedure arc(x,y, radius,startAngle,endAngle : TCanvasCoordType; antiClockWise : boolean); overload;
|
|
1746
|
+
procedure arcTo(x1,y1,x2,y2,radius : TCanvasCoordType); overload;
|
|
1747
|
+
procedure beginPath;
|
|
1748
|
+
procedure bezierCurveTo(cp1x,cp1y,cp2x,cp2y,x,y : TCanvasCoordType); overload;
|
|
1749
|
+
procedure clearRect(x,y,width,height : TCanvasCoordType);
|
|
1750
|
+
procedure clip; overload;
|
|
1751
|
+
procedure clip(aFillRule : String); overload;
|
|
1752
|
+
procedure clip(aPath : TJSPath2D); overload;
|
|
1753
|
+
procedure closePath;
|
|
1754
|
+
function createImageData(aWidth,aHeight : Integer) : TJSImageData; overload;
|
|
1755
|
+
function createImageData(aImage : TJSImageData) : TJSImageData; overload;
|
|
1756
|
+
function createLinearGradient(x0,y0,x1,y1 : TCanvasCoordType) : TJSCanvasGradient;
|
|
1757
|
+
function createPattern(aImage : TJSObject; repetition : string) : TJSCanvasPattern;
|
|
1758
|
+
function createRadialGradient(x0,y0,r0,x1,y1,r1 : TCanvasCoordType) : TJSCanvasGradient;
|
|
1759
|
+
|
|
1760
|
+
procedure drawImage(image : TJSObject; dx,dy : TCanvasCoordType); overload;
|
|
1761
|
+
procedure drawImage(image : TJSObject; dx,dy,dwidth,dheight : TCanvasCoordType); overload;
|
|
1762
|
+
procedure drawImage(image : TJSObject; sx,sy,sWidth,sHeight,dx,dy,dwidth,dheight : TCanvasCoordType); overload;
|
|
1763
|
+
procedure ellipse(x, y, radiusX, radiusY : TCanvasCoordType; rotation, startAngle, endAngle : Double); overload;
|
|
1764
|
+
procedure ellipse(x, y, radiusX, radiusY : TCanvasCoordType; rotation, startAngle, endAngle : Double; anticlockwise : Boolean); overload;
|
|
1765
|
+
procedure fill; overload;
|
|
1766
|
+
procedure fill(aRule : String); overload;
|
|
1767
|
+
procedure fill(aPath : TJSPath2D); overload;
|
|
1768
|
+
procedure fill(aPath : TJSPath2D;aRule : String); overload;
|
|
1769
|
+
procedure fillRect(x,y,awidth,aheight: TCanvasCoordType); overload;
|
|
1770
|
+
procedure fillText(aText : string; x,y : TCanvasCoordType); overload;
|
|
1771
|
+
procedure fillText(aText : string; x,y, aMaxWidth : TCanvasCoordType); overload;
|
|
1772
|
+
function getImageData(x,y,awidth,aheight: TCanvasCoordType) : TJSImageData; overload;
|
|
1773
|
+
function getLineDash : TJSArray;
|
|
1774
|
+
function isPointInPath(x,y : TCanvasCoordType) : Boolean; overload;
|
|
1775
|
+
function isPointInPath(x,y : TCanvasCoordType; aFillRule : String) : Boolean; overload;
|
|
1776
|
+
function isPointInPath(aPath : TJSPath2D; x,y : TCanvasCoordType) : Boolean; overload;
|
|
1777
|
+
function isPointInPath(aPath : TJSPath2D; x,y : TCanvasCoordType; aFillRule : String) : Boolean; overload;
|
|
1778
|
+
function isPointInStroke(x,y : TCanvasCoordType) : Boolean; overload;
|
|
1779
|
+
function isPointInStroke(aPath : TJSPath2D; x,y : TCanvasCoordType) : Boolean; overload;
|
|
1780
|
+
procedure lineTo(x,y : TCanvasCoordType);
|
|
1781
|
+
function measureText(S : String) : TJSTextMetrics;
|
|
1782
|
+
procedure moveTo(x,y : TCanvasCoordType);
|
|
1783
|
+
procedure putImageData(aData : TJSImageData; x,y: TCanvasCoordType) ; overload;
|
|
1784
|
+
procedure putImageData(aData : TJSImageData; x,y,dityX,dirtyY,dirtyWidth,dirtyHeight: TCanvasCoordType) ; overload;
|
|
1785
|
+
procedure quadraticCurveTo(cpx,cpy,x,y : TCanvasCoordType);
|
|
1786
|
+
procedure rect(x,y,awidth,aheight: TCanvasCoordType); overload;
|
|
1787
|
+
procedure restore;
|
|
1788
|
+
procedure rotate(anAngle : double);
|
|
1789
|
+
procedure roundRect(x,y,width,height : double; Radii : TJSArray);
|
|
1790
|
+
procedure save;
|
|
1791
|
+
procedure scale(x,y : double);
|
|
1792
|
+
procedure setLineDash(segments : TJSArray); overload;
|
|
1793
|
+
procedure setLineDash(segments : array of integer); overload;
|
|
1794
|
+
procedure resetTransform;
|
|
1795
|
+
procedure setTransform(a,b,c,d,e,f : double);
|
|
1796
|
+
procedure stroke; overload;
|
|
1797
|
+
procedure stroke(aPath : TJSPath2D); overload;
|
|
1798
|
+
procedure strokeRect(x,y,awidth,aheight: TCanvasCoordType);
|
|
1799
|
+
procedure strokeText(aText : string; x,y : TCanvasCoordType); overload;
|
|
1800
|
+
procedure strokeText(aText : string; x,y, aMaxWidth : TCanvasCoordType); overload;
|
|
1801
|
+
procedure transform(a,b,c,d,e,f : double);
|
|
1802
|
+
procedure translate(x,y : TCanvasCoordType);
|
|
1803
|
+
|
|
1804
|
+
property fillStyleAsColor : String Read FfillStyleColor Write FfillStyleColor;
|
|
1805
|
+
property fillStyleAsGradient : TJSCanvasGradient Read FfillStyleGradient Write FfillStyleGradient;
|
|
1806
|
+
property fillStyleAsPattern : TJSCanvasPattern Read FfillStylePattern Write FfillStylePattern;
|
|
1807
|
+
property imageSmoothingEnabled : Boolean Read FimageSmoothingEnabled Write FimageSmoothingEnabled;
|
|
1808
|
+
property strokeStyleAsColor : String Read FstrokeStyleColor Write FstrokeStyleColor;
|
|
1809
|
+
property strokeStyleAsGradient : TJSCanvasGradient Read FstrokeStyleGradient Write FstrokeStyleGradient;
|
|
1810
|
+
property strokeStyleAsPattern : TJSCanvasPattern Read FstrokeStylePattern Write FstrokeStylePattern;
|
|
1811
|
+
end;
|
|
1812
|
+
|
|
1813
|
+
TJSCanvasRenderingContext2D = class external name 'CanvasRenderingContext2D'(TJSBaseCanvasRenderingContext2D);
|
|
1814
|
+
|
|
1815
|
+
{ TJSImageBitmap }
|
|
1816
|
+
|
|
1817
|
+
TJSImageBitmap = class external name 'ImageBitmap' (TJSObject)
|
|
1818
|
+
private
|
|
1819
|
+
FHeight: cardinal; external name 'height';
|
|
1820
|
+
FWidth: cardinal; external name 'width';
|
|
1821
|
+
public
|
|
1822
|
+
procedure close();
|
|
1823
|
+
property width : cardinal read FWidth;
|
|
1824
|
+
property height : cardinal read FHeight;
|
|
1825
|
+
end;
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
TJSImageBitmapCanvasRenderingContext = class external name 'ImageBitmapRenderingContext' (TJSBaseCanvasRenderingContext2D)
|
|
1829
|
+
procedure transferFromImageBitmap(aBitmap : TJSImageBitmap);
|
|
1830
|
+
private
|
|
1831
|
+
FCanvas: TJSHTMLOffscreenCanvas; external name 'canvas';
|
|
1832
|
+
public
|
|
1833
|
+
property canvas : TJSHTMLOffscreenCanvas Read FCanvas;
|
|
1834
|
+
end;
|
|
1835
|
+
|
|
1836
|
+
TJSConvertToBlobOptions = class external name 'Object' (TJSObject)
|
|
1837
|
+
type_ : string; external name 'type';
|
|
1838
|
+
quality : double;
|
|
1839
|
+
end;
|
|
1840
|
+
|
|
1841
|
+
TJSHTMLOffscreenCanvas = Class external name 'OffscreenCanvas' (TJSObject)
|
|
1842
|
+
Public
|
|
1843
|
+
constructor New(x,y : Cardinal); overload;
|
|
1844
|
+
Function getContext(contextType : string; contextAttributes : TJSObject) : JSValue;
|
|
1845
|
+
Function getContext(contextType : string) : JSValue;
|
|
1846
|
+
Function getContextAs2DContext(contextType : string) : TJSOffscreenCanvasRenderingContext2D; external name 'getContext'; reintroduce;
|
|
1847
|
+
Function getContextAs2DContext(contextType : string; contextAttributes : TJSObject) : TJSOffscreenCanvasRenderingContext2D; external name 'getContext'; reintroduce;
|
|
1848
|
+
Function getContextAsImageBitmapContext(contextType : string) : TJSImageBitmapCanvasRenderingContext; external name 'getContext'; reintroduce;
|
|
1849
|
+
function transferToImageBitmap: TJSImageBitmap;
|
|
1850
|
+
function convertToBlob() : TJSPromise;
|
|
1851
|
+
function convertToBlob(options : TJSConvertToBlobOptions) : TJSPromise;
|
|
1852
|
+
height : Integer;
|
|
1853
|
+
width : Integer;
|
|
1854
|
+
end;
|
|
1855
|
+
|
|
1856
|
+
TJSOffscreenCanvasRenderingContext2D = class external name 'CanvasRenderingContext2D' (TJSBaseCanvasRenderingContext2D)
|
|
1857
|
+
private
|
|
1858
|
+
FCanvas: TJSHTMLOffscreenCanvas; external name 'canvas';
|
|
1859
|
+
public
|
|
1860
|
+
property canvas : TJSHTMLOffscreenCanvas Read FCanvas;
|
|
1861
|
+
end;
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
{ TJSMessageChannel }
|
|
1865
|
+
|
|
1866
|
+
TJSMessageChannel = class external name 'MessageChannel' (TJSObject)
|
|
1867
|
+
private
|
|
1868
|
+
FPort1: TJSMessagePort; external name 'port1';
|
|
1869
|
+
FPort2: TJSMessagePort; external name 'port2';
|
|
1870
|
+
Public
|
|
1871
|
+
property port1 : TJSMessagePort read FPort1;
|
|
1872
|
+
property port2 : TJSMessagePort read FPort2;
|
|
1873
|
+
end;
|
|
1874
|
+
|
|
1875
|
+
{ TDOMRectReadOnly }
|
|
1876
|
+
|
|
1877
|
+
TDOMRectReadOnly = class external name 'DOMRectReadOnly' (TJSObject)
|
|
1878
|
+
private
|
|
1879
|
+
Fbottom: integer; external name 'bottom';
|
|
1880
|
+
Fheight: integer; external name 'height';
|
|
1881
|
+
Fleft: integer; external name 'left';
|
|
1882
|
+
Fright: integer; external name 'right';
|
|
1883
|
+
Ftop: integer; external name 'top';
|
|
1884
|
+
FWidth: integer; external name 'width';
|
|
1885
|
+
Fx: integer; external name 'x';
|
|
1886
|
+
Fy: integer; external name 'y';
|
|
1887
|
+
public
|
|
1888
|
+
property bottom : integer read Fbottom;
|
|
1889
|
+
property height : integer read Fheight;
|
|
1890
|
+
property left : integer read Fleft;
|
|
1891
|
+
property right : integer read Fright;
|
|
1892
|
+
property top : integer read Ftop;
|
|
1893
|
+
property width : integer Read FWidth;
|
|
1894
|
+
property x : integer read Fx;
|
|
1895
|
+
property y : integer read Fy;
|
|
1896
|
+
end;
|
|
1897
|
+
|
|
1898
|
+
{ --------------------------------------------------------------------
|
|
1899
|
+
TJSWorklet
|
|
1900
|
+
--------------------------------------------------------------------}
|
|
1901
|
+
TJSWorklet = class external name 'Worklet' (TJSObject)
|
|
1902
|
+
Private
|
|
1903
|
+
Public
|
|
1904
|
+
function addModule(moduleURL: String): TJSPromise; overload;
|
|
1905
|
+
function addModule(moduleURL: String; options: JSValue): TJSPromise; overload;
|
|
1906
|
+
end;
|
|
1907
|
+
|
|
1908
|
+
{ --------------------------------------------------------------------
|
|
1909
|
+
TJSAudioWorklet
|
|
1910
|
+
--------------------------------------------------------------------}
|
|
1911
|
+
|
|
1912
|
+
TJSAudioWorklet = class external name 'AudioWorklet' (TJSWorklet)
|
|
1913
|
+
Private
|
|
1914
|
+
Fport : TJSMessagePort; external name 'port';
|
|
1915
|
+
Public
|
|
1916
|
+
property port : TJSMessagePort read Fport;
|
|
1917
|
+
end;
|
|
1918
|
+
|
|
1919
|
+
TJSScriptContext = (jscUnknown,jscMainBrowserThread,jscWebWorker,jscServiceWorker);
|
|
1920
|
+
|
|
1921
|
+
{ TJSDOMException }
|
|
1922
|
+
|
|
1923
|
+
TJSDOMException = class external name 'DOMException' (TJSObject)
|
|
1924
|
+
private
|
|
1925
|
+
FCode: Integer; external name 'code';
|
|
1926
|
+
FMessage: String; external name 'message';
|
|
1927
|
+
FName: string; external name 'name';
|
|
1928
|
+
Public
|
|
1929
|
+
Property code : Integer Read FCode;
|
|
1930
|
+
Property Message : String Read FMessage;
|
|
1931
|
+
Property name : string Read FName;
|
|
1932
|
+
end;
|
|
1933
|
+
|
|
1934
|
+
{ TJSFileReader }
|
|
1935
|
+
|
|
1936
|
+
TJSFileReader = class external name 'FileReader' (TJSEventTarget)
|
|
1937
|
+
private
|
|
1938
|
+
FError: TJSDOMException; external name 'error';
|
|
1939
|
+
fReadyState: Integer; external name 'readyState';
|
|
1940
|
+
FResult: JSValue; external name 'result';
|
|
1941
|
+
Public
|
|
1942
|
+
Const EMPTY : Integer;
|
|
1943
|
+
Const LOADING : Integer;
|
|
1944
|
+
Const DONE : Integer;
|
|
1945
|
+
Public
|
|
1946
|
+
onabort : TJSEventHandler;
|
|
1947
|
+
onerror : TJSEventHandler;
|
|
1948
|
+
onload : TJSEventHandler;
|
|
1949
|
+
onloadstart : TJSEventHandler;
|
|
1950
|
+
onloadend : TJSEventHandler;
|
|
1951
|
+
onprogress : TJSEventHandler;
|
|
1952
|
+
Public
|
|
1953
|
+
constructor new;
|
|
1954
|
+
Procedure abort;
|
|
1955
|
+
procedure readAsArrayBuffer(Blob: TJSBlob);
|
|
1956
|
+
procedure readAsBinaryString(Blob: TJSBlob);
|
|
1957
|
+
procedure readAsDataURL(Blob: TJSBlob);
|
|
1958
|
+
procedure readAsText(Blob: TJSBlob; encoding : string);
|
|
1959
|
+
procedure readAsText(Blob: TJSBlob);
|
|
1960
|
+
property Error : TJSDOMException read FError;
|
|
1961
|
+
Property readyState : Integer Read fReadyState;
|
|
1962
|
+
property Result : JSValue Read FResult;
|
|
1963
|
+
end;
|
|
1964
|
+
|
|
1965
|
+
TJSFontFaceDescriptors = class external name 'Object' (TJSObject)
|
|
1966
|
+
style: string;
|
|
1967
|
+
weight: string;
|
|
1968
|
+
stretch: string;
|
|
1969
|
+
unicodeRange: string;
|
|
1970
|
+
variant: string;
|
|
1971
|
+
featureSettings: string;
|
|
1972
|
+
display: string;
|
|
1973
|
+
// Add more properties if needed
|
|
1974
|
+
end;
|
|
1975
|
+
|
|
1976
|
+
TJSFontFace = class external name 'FontFace' (TJSObject)
|
|
1977
|
+
private
|
|
1978
|
+
FFamily: String; external name 'family';
|
|
1979
|
+
FStyle: String; external name 'style';
|
|
1980
|
+
FWeight: String; external name 'weight';
|
|
1981
|
+
FStretch: String; external name 'stretch';
|
|
1982
|
+
FUnicodeRange: String; external name 'unicodeRange';
|
|
1983
|
+
FDisplay: String; external name 'display';
|
|
1984
|
+
FLoaded: TJSPromise; external name 'loaded';
|
|
1985
|
+
FStatus: String; external name 'status';
|
|
1986
|
+
|
|
1987
|
+
public
|
|
1988
|
+
constructor new(aFamily: String; aFontURL: String); overload;
|
|
1989
|
+
constructor new(family: String; source: JSValue; descriptors: TJSFontFaceDescriptors); overload;
|
|
1990
|
+
|
|
1991
|
+
function Load: TJSPromise; external name 'load';
|
|
1992
|
+
|
|
1993
|
+
// Properties
|
|
1994
|
+
property Family: String read FFamily write FFamily;
|
|
1995
|
+
property Style: String read FStyle write FStyle;
|
|
1996
|
+
property Weight: String read FWeight write FWeight;
|
|
1997
|
+
property Stretch: String read FStretch write FStretch;
|
|
1998
|
+
property UnicodeRange: String read FUnicodeRange write FUnicodeRange;
|
|
1999
|
+
property Display: String read FDisplay write FDisplay;
|
|
2000
|
+
property Loaded: TJSPromise read FLoaded; // readonly
|
|
2001
|
+
property Status: String read FStatus; // readonly
|
|
2002
|
+
end;
|
|
2003
|
+
|
|
2004
|
+
TJSFontFaceSet = class external name 'FontFaceSet'
|
|
2005
|
+
private
|
|
2006
|
+
FStatus: string; external name 'status';
|
|
2007
|
+
FReady: TJSPromise; external name 'ready';
|
|
2008
|
+
|
|
2009
|
+
public
|
|
2010
|
+
function Check(const aFont: string): Boolean; external name 'check';
|
|
2011
|
+
function Load(const aFont: string; const aText: string = ''): TJSPromise; external name 'load';
|
|
2012
|
+
|
|
2013
|
+
procedure Add(aFontFace: TJSFontFace); external name 'add';
|
|
2014
|
+
procedure Delete(aFontFace: TJSFontFace); external name 'delete';
|
|
2015
|
+
function Has(aFontFace: TJSFontFace): Boolean; external name 'has';
|
|
2016
|
+
|
|
2017
|
+
property Status: string read FStatus; // readonly
|
|
2018
|
+
property Ready: TJSPromise read FReady; // readonly
|
|
2019
|
+
end;
|
|
2020
|
+
|
|
2021
|
+
TJSPressureRecord = class external name 'Object' (TJSObject)
|
|
2022
|
+
source : String;
|
|
2023
|
+
state : String;
|
|
2024
|
+
time : Double;
|
|
2025
|
+
end;
|
|
2026
|
+
TJSPressureRecordArray = Array of TJSPressureRecord;
|
|
2027
|
+
|
|
2028
|
+
TPressureUpdateCallback = reference to procedure(aRecords : TJSPressureRecordArray; aObserver : TJSObject);
|
|
2029
|
+
|
|
2030
|
+
TJSPressureObserverOptions = class external name 'Object' (TJSObject)
|
|
2031
|
+
sampleInterval : Double;
|
|
2032
|
+
end;
|
|
2033
|
+
|
|
2034
|
+
TJSPressureObserver = class external name 'PressureObserver' (TJSObject)
|
|
2035
|
+
private
|
|
2036
|
+
class var FKnownSources : TJSStringDynArray; external name 'knownSources';
|
|
2037
|
+
public
|
|
2038
|
+
constructor new(aCallback : TPressureUpdateCallback);
|
|
2039
|
+
procedure observe(aSource : String); overload;
|
|
2040
|
+
procedure observe(aSource : String; aOptions : TJSPressureObserverOptions); overload;
|
|
2041
|
+
procedure unobserve(aSource : String);
|
|
2042
|
+
procedure disconnect;
|
|
2043
|
+
function takeRecords : TJSPressureRecordArray;
|
|
2044
|
+
class property knownSources : TJSStringDynArray read FKnownSources;
|
|
2045
|
+
end;
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
function isMainBrowserThread: boolean;
|
|
2050
|
+
function isWebWorker : boolean;
|
|
2051
|
+
function IsServiceWorker :boolean;
|
|
2052
|
+
function GetScriptContext : TJSScriptContext;
|
|
2053
|
+
|
|
2054
|
+
var
|
|
2055
|
+
Console : TJSConsole; external name 'console';
|
|
2056
|
+
Crypto: TJSCrypto; external name 'crypto';
|
|
2057
|
+
indexedDB : TJSIDBFactory; external name 'indexedDB';
|
|
2058
|
+
self_ : TWindowOrWorkerGlobalScope; external name 'self';
|
|
2059
|
+
performance : TJSPerformance; external name 'self.performance';
|
|
2060
|
+
|
|
2061
|
+
function fetch(resource: String; init: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
2062
|
+
//function fetch(resource: String): TJSPromise; overload; external name 'fetch';
|
|
2063
|
+
function fetch(resource: String): TJSResponse; {$IFNDEF SkipAsync}async;{$ENDIF} overload; external name 'fetch';
|
|
2064
|
+
function fetchAsync(resource: String; init: TJSObject): TJSResponse; {$IFNDEF SkipAsync}async;{$ENDIF} external name 'fetch';
|
|
2065
|
+
function fetch(resource: TJSObject; init: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
2066
|
+
function fetch(resource: TJSObject): TJSPromise; overload; external name 'fetch';
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
implementation
|
|
2070
|
+
|
|
2071
|
+
function GetScriptContext : TJSScriptContext;
|
|
2072
|
+
begin
|
|
2073
|
+
Result:=jscUnknown;
|
|
2074
|
+
if isMainBrowserThread then
|
|
2075
|
+
exit(jscMainBrowserThread);
|
|
2076
|
+
if isWebWorker then
|
|
2077
|
+
exit(jscWebWorker);
|
|
2078
|
+
if IsServiceWorker then
|
|
2079
|
+
exit(jscServiceWorker);
|
|
2080
|
+
end;
|
|
2081
|
+
|
|
2082
|
+
function isMainBrowserThread: boolean; assembler;
|
|
2083
|
+
asm
|
|
2084
|
+
return (typeof window !== "undefined");
|
|
2085
|
+
end;
|
|
2086
|
+
|
|
2087
|
+
function isWebWorker : boolean; assembler;
|
|
2088
|
+
|
|
2089
|
+
asm
|
|
2090
|
+
return (typeof DedicatedWorkerGlobalScope !== 'undefined') &&
|
|
2091
|
+
(self instanceof DedicatedWorkerGlobalScope);
|
|
2092
|
+
end;
|
|
2093
|
+
|
|
2094
|
+
function IsServiceWorker :boolean; assembler;
|
|
2095
|
+
|
|
2096
|
+
asm
|
|
2097
|
+
return (typeof ServiceWorkerGlobalScope !== 'undefined') && (self instanceof ServiceWorkerGlobalScope);
|
|
2098
|
+
end;
|
|
2099
|
+
|
|
2100
|
+
end.
|
|
2101
|
+
|