@types/nw.js 0.91.0 → 0.115.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.
- nw.js/README.md +1 -1
- nw.js/index.d.ts +762 -51
- nw.js/package.json +4 -3
nw.js/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for nw.js (http://nwjs.io).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nw.js.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Thu, 27 Aug 2026 14:08:41 GMT
|
|
12
12
|
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
|
13
13
|
|
|
14
14
|
# Credits
|
nw.js/index.d.ts
CHANGED
|
@@ -19,6 +19,20 @@ declare global {
|
|
|
19
19
|
*/
|
|
20
20
|
set(data: string, type?: string, raw?: boolean): void;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Write `clipboardData` to the clipboard.
|
|
24
|
+
*
|
|
25
|
+
* @param clipboardData {NWJS_Helpers.ClipboardData} JSON object containing `data`, `type` and `raw` to be written to clipboard.
|
|
26
|
+
*/
|
|
27
|
+
set(clipboardData: ClipboardData): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Write multiple types of data to clipboard simultaneously.
|
|
31
|
+
*
|
|
32
|
+
* @param clipboardDataList {NWJS_Helpers.ClipboardData[]} Array of `clipboardData` to be written to clipboard.
|
|
33
|
+
*/
|
|
34
|
+
set(clipboardDataList: ClipboardData[]): void;
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
* Get the data of `type` from clipboard.
|
|
24
38
|
*
|
|
@@ -28,6 +42,22 @@ declare global {
|
|
|
28
42
|
*/
|
|
29
43
|
get(type?: string, raw?: boolean): string;
|
|
30
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Get the data described by `clipboardData` from clipboard.
|
|
47
|
+
*
|
|
48
|
+
* @param clipboardData {NWJS_Helpers.ClipboardReadOptions} JSON object containing `type` and `raw` argument for reading data from clipboard.
|
|
49
|
+
* @returns {string} the data retrieved from the clipboard.
|
|
50
|
+
*/
|
|
51
|
+
get(clipboardData: ClipboardReadOptions): string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get multiple types of data from clipboard simultaneously.
|
|
55
|
+
*
|
|
56
|
+
* @param clipboardDataList {NWJS_Helpers.ClipboardReadOptions[]} Array of `clipboardData` for reading data from clipboard.
|
|
57
|
+
* @returns {NWJS_Helpers.ClipboardDataResult[]} array of `clipboardData` retrieved from the clipboard. Each item contains `type`, `data` and `raw` (optional) attributes.
|
|
58
|
+
*/
|
|
59
|
+
get(clipboardDataList: ClipboardReadOptions[]): ClipboardDataResult[];
|
|
60
|
+
|
|
31
61
|
/**
|
|
32
62
|
* Get an array contains list of available types of data in clipboard currenly.
|
|
33
63
|
* You can use the returned list as a suggestion to get the right data from clipboard.
|
|
@@ -42,6 +72,61 @@ declare global {
|
|
|
42
72
|
clear(): void;
|
|
43
73
|
}
|
|
44
74
|
|
|
75
|
+
/**
|
|
76
|
+
* JSON object containing `data`, `type` and `raw` to be written to the clipboard via `clip.set()`.
|
|
77
|
+
*/
|
|
78
|
+
interface ClipboardData {
|
|
79
|
+
/**
|
|
80
|
+
* The data to write to the clipboard.
|
|
81
|
+
*/
|
|
82
|
+
data: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* (Optional) the type of the data. Support text, png, jpeg, html and rtf. By default, type is set to "text".
|
|
86
|
+
*/
|
|
87
|
+
type?: string | undefined;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* (Optional) requiring raw image data. This option is only valid if type is png or jpeg. By default, raw is set to false.
|
|
91
|
+
*/
|
|
92
|
+
raw?: boolean | undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* JSON object containing `type` and `raw` argument for reading data from the clipboard via `clip.get()`.
|
|
97
|
+
*/
|
|
98
|
+
interface ClipboardReadOptions {
|
|
99
|
+
/**
|
|
100
|
+
* (Optional) the type of the data. Support text, png, jpeg, html and rtf. By default, type is set to "text".
|
|
101
|
+
*/
|
|
102
|
+
type?: string | undefined;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* (Optional) requiring raw image data. This option is only valid if type is png or jpeg.
|
|
106
|
+
*/
|
|
107
|
+
raw?: boolean | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* An item returned by `clip.get(clipboardDataList)`.
|
|
112
|
+
*/
|
|
113
|
+
interface ClipboardDataResult {
|
|
114
|
+
/**
|
|
115
|
+
* The type of the data.
|
|
116
|
+
*/
|
|
117
|
+
type: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The data retrieved from the clipboard.
|
|
121
|
+
*/
|
|
122
|
+
data: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* (Optional) Whether the image data is raw. Only present if type is png or jpeg.
|
|
126
|
+
*/
|
|
127
|
+
raw?: boolean | undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
45
130
|
/**
|
|
46
131
|
* Object that contains options to use while creation of nw.Menu. example: new nw.Menu(MenuOption)
|
|
47
132
|
*/
|
|
@@ -49,7 +134,7 @@ declare global {
|
|
|
49
134
|
/**
|
|
50
135
|
* {string} (Optional) two types are accepted by this method: "menubar" or "contextmenu". The value is set to "contextmenu" by default.
|
|
51
136
|
*/
|
|
52
|
-
type
|
|
137
|
+
type?: "menubar" | "contextmenu" | undefined;
|
|
53
138
|
}
|
|
54
139
|
|
|
55
140
|
/**
|
|
@@ -175,7 +260,10 @@ declare global {
|
|
|
175
260
|
* @param should_include_screens {boolean} Whether should include screens
|
|
176
261
|
* @param should_include_windows {boolean} Whether should include windows
|
|
177
262
|
*/
|
|
178
|
-
start(
|
|
263
|
+
start(
|
|
264
|
+
should_include_screens: boolean,
|
|
265
|
+
should_include_windows: boolean,
|
|
266
|
+
): void;
|
|
179
267
|
|
|
180
268
|
/**
|
|
181
269
|
* The DesktopCaptureMonitor will stop monitoring the system.
|
|
@@ -186,8 +274,9 @@ declare global {
|
|
|
186
274
|
* Register and return a valid stream id passed into chromeMediaSourceId in getUserMedia constraints.
|
|
187
275
|
*
|
|
188
276
|
* @param id {string} valid stream id.
|
|
277
|
+
* @returns {string} the registered stream id, to be passed into `chromeMediaSourceId` in `getUserMedia` constraints.
|
|
189
278
|
*/
|
|
190
|
-
registerStream(id: string):
|
|
279
|
+
registerStream(id: string): string;
|
|
191
280
|
|
|
192
281
|
on(event: string, listener: Function): this;
|
|
193
282
|
|
|
@@ -204,7 +293,13 @@ declare global {
|
|
|
204
293
|
*/
|
|
205
294
|
on(
|
|
206
295
|
event: "added",
|
|
207
|
-
listener: (
|
|
296
|
+
listener: (
|
|
297
|
+
id: string,
|
|
298
|
+
name: string,
|
|
299
|
+
order: number,
|
|
300
|
+
type: string,
|
|
301
|
+
primary: boolean,
|
|
302
|
+
) => any,
|
|
208
303
|
): this;
|
|
209
304
|
|
|
210
305
|
/**
|
|
@@ -225,7 +320,10 @@ declare global {
|
|
|
225
320
|
* - (optional) new_order {number} Is the new z-order.
|
|
226
321
|
* - (optional) old_order {number} Is the old z-order.
|
|
227
322
|
*/
|
|
228
|
-
on(
|
|
323
|
+
on(
|
|
324
|
+
event: "orderchanged",
|
|
325
|
+
listener: (id?: string, new_order?: number, old_order?: number) => any,
|
|
326
|
+
): this;
|
|
229
327
|
|
|
230
328
|
/**
|
|
231
329
|
* Emit when the name of the source has changed. This can happen when a window changes title.
|
|
@@ -235,7 +333,10 @@ declare global {
|
|
|
235
333
|
* - (optional) id {string} Is the media id of the screen or window that has a name changed.
|
|
236
334
|
* - (optional) name {string} Is the new name of the screen or window.
|
|
237
335
|
*/
|
|
238
|
-
on(
|
|
336
|
+
on(
|
|
337
|
+
event: "namechanged",
|
|
338
|
+
listener: (id?: string, name?: string) => any,
|
|
339
|
+
): this;
|
|
239
340
|
|
|
240
341
|
/**
|
|
241
342
|
* Emit when the thumbnail of a source changed.
|
|
@@ -245,7 +346,10 @@ declare global {
|
|
|
245
346
|
* - (optional) id {string} Is the media id of the screen or window that has an updated thumbnail.
|
|
246
347
|
* - (optional) name {string} Is the base64 encoded png of the thumbnail.
|
|
247
348
|
*/
|
|
248
|
-
on(
|
|
349
|
+
on(
|
|
350
|
+
event: "thumbnailchanged",
|
|
351
|
+
listener: (id?: string, thumbnail?: string) => any,
|
|
352
|
+
): this;
|
|
249
353
|
}
|
|
250
354
|
|
|
251
355
|
/**
|
|
@@ -255,14 +359,14 @@ declare global {
|
|
|
255
359
|
/**
|
|
256
360
|
* {Function} (Optional) A callback when the hotkey is triggered.
|
|
257
361
|
*/
|
|
258
|
-
active
|
|
362
|
+
active?: Function | undefined;
|
|
259
363
|
|
|
260
364
|
/**
|
|
261
365
|
* {Function} (Optional) A callback when failed to register the hotkey.
|
|
262
366
|
*
|
|
263
367
|
* @param msg {string} Failure message
|
|
264
368
|
*/
|
|
265
|
-
failed
|
|
369
|
+
failed?: ((msg?: string) => any) | undefined;
|
|
266
370
|
|
|
267
371
|
/**
|
|
268
372
|
* {string} Key combinations of the shortcut, such as "ctrl+shift+a".
|
|
@@ -310,35 +414,131 @@ declare global {
|
|
|
310
414
|
*/
|
|
311
415
|
interface PrintOption {
|
|
312
416
|
/**
|
|
313
|
-
*
|
|
417
|
+
* (Optional) Whether to print without the need for user's interaction. True by default.
|
|
314
418
|
*/
|
|
315
|
-
|
|
419
|
+
autoprint?: boolean | undefined;
|
|
316
420
|
|
|
317
421
|
/**
|
|
318
|
-
*
|
|
422
|
+
* (Optional) Hide the flashing print preview dialog. False by default.
|
|
319
423
|
*/
|
|
320
|
-
|
|
424
|
+
silent?: boolean | undefined;
|
|
321
425
|
|
|
322
426
|
/**
|
|
323
|
-
*
|
|
427
|
+
* (Optional) The device name of the printer returned by `nw.Window.getPrinters()`. No need to set this when printing to PDF.
|
|
324
428
|
*/
|
|
325
|
-
|
|
429
|
+
printer?: string | undefined;
|
|
326
430
|
|
|
327
431
|
/**
|
|
328
|
-
*
|
|
432
|
+
* (Optional) The path of the output PDF when printing to PDF
|
|
329
433
|
*/
|
|
330
|
-
|
|
434
|
+
pdf_path?: string | undefined;
|
|
331
435
|
|
|
332
436
|
/**
|
|
333
|
-
*
|
|
437
|
+
* (Optional) Whether to enable header and footer
|
|
438
|
+
*/
|
|
439
|
+
headerFooterEnabled?: boolean | undefined;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* (Optional) Whether to use landscape or portrait
|
|
443
|
+
*/
|
|
444
|
+
landscape?: boolean | undefined;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* (Optional) The paper size spec
|
|
334
448
|
* example: 'mediaSize':{'name': 'CUSTOM', 'width_microns': 279400, 'height_microns': 215900, 'custom_display_name':'Letter', 'is_default': true}
|
|
335
449
|
*/
|
|
336
|
-
mediaSize
|
|
450
|
+
mediaSize?: PrintMediaSize | undefined;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* (Optional) Whether to print CSS backgrounds
|
|
454
|
+
*/
|
|
455
|
+
shouldPrintBackgrounds?: boolean | undefined;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* (Optional) 0 - Default; 1 - No margins; 2 - minimum; 3 - Custom, see `marginsCustom`.
|
|
459
|
+
*/
|
|
460
|
+
marginsType?: number | undefined;
|
|
337
461
|
|
|
338
462
|
/**
|
|
339
|
-
*
|
|
463
|
+
* (Optional) The custom margin setting; units are points.
|
|
464
|
+
* example: "marginsCustom":{"marginBottom":54,"marginLeft":70,"marginRight":28,"marginTop":32}
|
|
340
465
|
*/
|
|
341
|
-
|
|
466
|
+
marginsCustom?: PrintMarginsCustom | undefined;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* (Optional) The number of copies to print.
|
|
470
|
+
*/
|
|
471
|
+
copies?: number | undefined;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* (Optional) The scale factor; 100 is the default.
|
|
475
|
+
*/
|
|
476
|
+
scaleFactor?: number | undefined;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* (Optional) String to replace the URL in the header.
|
|
480
|
+
*/
|
|
481
|
+
headerString?: string | undefined;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* (Optional) String to replace the URL in the footer.
|
|
485
|
+
*/
|
|
486
|
+
footerString?: string | undefined;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* The custom margin setting used by `PrintOption.marginsCustom`. Units are points.
|
|
491
|
+
*/
|
|
492
|
+
interface PrintMarginsCustom {
|
|
493
|
+
/**
|
|
494
|
+
* (Optional) The bottom margin, in points.
|
|
495
|
+
*/
|
|
496
|
+
marginBottom?: number | undefined;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* (Optional) The left margin, in points.
|
|
500
|
+
*/
|
|
501
|
+
marginLeft?: number | undefined;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* (Optional) The right margin, in points.
|
|
505
|
+
*/
|
|
506
|
+
marginRight?: number | undefined;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* (Optional) The top margin, in points.
|
|
510
|
+
*/
|
|
511
|
+
marginTop?: number | undefined;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* The paper size spec used by `PrintOption.mediaSize`.
|
|
516
|
+
*/
|
|
517
|
+
interface PrintMediaSize {
|
|
518
|
+
/**
|
|
519
|
+
* (Optional) The name of the paper size, e.g. "CUSTOM" or "NA_LETTER".
|
|
520
|
+
*/
|
|
521
|
+
name?: string | undefined;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* (Optional) The paper width in microns.
|
|
525
|
+
*/
|
|
526
|
+
width_microns?: number | undefined;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* (Optional) The paper height in microns.
|
|
530
|
+
*/
|
|
531
|
+
height_microns?: number | undefined;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* (Optional) The display name shown for the paper size, e.g. "Letter".
|
|
535
|
+
*/
|
|
536
|
+
custom_display_name?: string | undefined;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* (Optional) Whether this is the default paper size.
|
|
540
|
+
*/
|
|
541
|
+
is_default?: boolean | undefined;
|
|
342
542
|
}
|
|
343
543
|
|
|
344
544
|
/**
|
|
@@ -356,6 +556,61 @@ declare global {
|
|
|
356
556
|
datatype?: string | undefined;
|
|
357
557
|
}
|
|
358
558
|
|
|
559
|
+
/**
|
|
560
|
+
* Options for nw.Window.get().captureScreenshot().
|
|
561
|
+
*/
|
|
562
|
+
interface CaptureScreenshotOptions {
|
|
563
|
+
/**
|
|
564
|
+
* (Optional) Capture the whole page beyond the visible area. Currently the height of captured image is capped at 16384 pixels by Chromium.
|
|
565
|
+
*/
|
|
566
|
+
fullSize?: boolean | undefined;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* (Optional) The image format used to generate the image. It supports two formats: "png" and "jpeg". "png" is the default.
|
|
570
|
+
*/
|
|
571
|
+
format?: string | undefined;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* (Optional) Compression quality from range [0..100] (jpeg only).
|
|
575
|
+
*/
|
|
576
|
+
quality?: number | undefined;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* (Optional) Capture the screenshot of a given region only.
|
|
580
|
+
*/
|
|
581
|
+
clip?: CaptureScreenshotClip | undefined;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Region to capture, used by `CaptureScreenshotOptions.clip`.
|
|
586
|
+
*/
|
|
587
|
+
interface CaptureScreenshotClip {
|
|
588
|
+
/**
|
|
589
|
+
* X offset in device independent pixels (dip).
|
|
590
|
+
*/
|
|
591
|
+
x: number;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Y offset in device independent pixels (dip).
|
|
595
|
+
*/
|
|
596
|
+
y: number;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Rectangle width in device independent pixels (dip).
|
|
600
|
+
*/
|
|
601
|
+
width: number;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Rectangle height in device independent pixels (dip).
|
|
605
|
+
*/
|
|
606
|
+
height: number;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Page scale factor.
|
|
610
|
+
*/
|
|
611
|
+
scale: number;
|
|
612
|
+
}
|
|
613
|
+
|
|
359
614
|
/**
|
|
360
615
|
* This includes multiple functions to manipulate the cookies.
|
|
361
616
|
*/
|
|
@@ -367,7 +622,10 @@ declare global {
|
|
|
367
622
|
* @param callback {function(cookie?)} The callback when cookie retrieved.
|
|
368
623
|
* - (Optional) cookie {Cookie} Contains details about the cookie. This parameter is null if no such cookie was found.
|
|
369
624
|
*/
|
|
370
|
-
get(
|
|
625
|
+
get(
|
|
626
|
+
details: CookiesGetDetails,
|
|
627
|
+
callback: (cookie?: Cookie) => void,
|
|
628
|
+
): void;
|
|
371
629
|
|
|
372
630
|
/**
|
|
373
631
|
* Retrieves all cookies from a single cookie store that match the given information.
|
|
@@ -376,7 +634,10 @@ declare global {
|
|
|
376
634
|
* @param callback {function(cookies?)} The callback when cookies retrieved.
|
|
377
635
|
* - (Optional) cookies {Cookie[]} All the existing, unexpired cookies that match the given cookie info.
|
|
378
636
|
*/
|
|
379
|
-
getAll(
|
|
637
|
+
getAll(
|
|
638
|
+
details: CookiesGetAllDetails,
|
|
639
|
+
callback: (cookies?: Cookie[]) => void,
|
|
640
|
+
): void;
|
|
380
641
|
|
|
381
642
|
/**
|
|
382
643
|
* Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
|
|
@@ -385,7 +646,10 @@ declare global {
|
|
|
385
646
|
* @param callback {function(cookie?)} The callback when cookie has been set.
|
|
386
647
|
* - (Optional) cookie {Cookie} Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
|
|
387
648
|
*/
|
|
388
|
-
set(
|
|
649
|
+
set(
|
|
650
|
+
details: CookiesSetDetails,
|
|
651
|
+
callback: (cookie?: Cookie) => void,
|
|
652
|
+
): void;
|
|
389
653
|
|
|
390
654
|
/**
|
|
391
655
|
* Deletes a cookie by name.
|
|
@@ -394,7 +658,10 @@ declare global {
|
|
|
394
658
|
* @param callback {function(cookie?)} The callback when cookie has been set.
|
|
395
659
|
* - (Optional) details {Objet} Contains details about the cookie that's been removed. If removal failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set.
|
|
396
660
|
*/
|
|
397
|
-
remove(
|
|
661
|
+
remove(
|
|
662
|
+
details: CookiesRemoveDetails,
|
|
663
|
+
callback: (details?: CookiesRemovedDetails) => void,
|
|
664
|
+
): void;
|
|
398
665
|
|
|
399
666
|
/**
|
|
400
667
|
* Fired when a cookie is set or removed.
|
|
@@ -406,7 +673,18 @@ declare global {
|
|
|
406
673
|
* @param callback {function(changeInfo?)} The callback when cookie has been changed.
|
|
407
674
|
* - (Optional) changeInfo {Objet} Contains details about the cookie that's been changed.
|
|
408
675
|
*/
|
|
409
|
-
addListener(
|
|
676
|
+
addListener(
|
|
677
|
+
callback: (changeInfo: CookiesOnChangedCallbackChangeInfo) => void,
|
|
678
|
+
): void;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Remove a listener for onChanged event.
|
|
682
|
+
*
|
|
683
|
+
* @param callback {function(changeInfo?)} The callback to remove.
|
|
684
|
+
*/
|
|
685
|
+
removeListener(
|
|
686
|
+
callback: (changeInfo: CookiesOnChangedCallbackChangeInfo) => void,
|
|
687
|
+
): void;
|
|
410
688
|
};
|
|
411
689
|
}
|
|
412
690
|
|
|
@@ -642,7 +920,13 @@ declare global {
|
|
|
642
920
|
/**
|
|
643
921
|
* The underlying reason behind the cookie's change.
|
|
644
922
|
*/
|
|
645
|
-
cause:
|
|
923
|
+
cause:
|
|
924
|
+
| string
|
|
925
|
+
| "evicted"
|
|
926
|
+
| "expired"
|
|
927
|
+
| "explicit"
|
|
928
|
+
| "expired_overwrite"
|
|
929
|
+
| "overwrite";
|
|
646
930
|
}
|
|
647
931
|
|
|
648
932
|
/**
|
|
@@ -682,6 +966,172 @@ declare global {
|
|
|
682
966
|
setNewWindowManifest(m: WindowOption): void;
|
|
683
967
|
}
|
|
684
968
|
|
|
969
|
+
/* Manifest Format: http://docs.nwjs.io/en/latest/References/Manifest%20Format/ */
|
|
970
|
+
/**
|
|
971
|
+
* The `package.json` manifest of an NW.js app, as returned by `nw.App.manifest`.
|
|
972
|
+
* Only the fields NW.js reads are typed here; a manifest may carry arbitrary
|
|
973
|
+
* additional `package.json` fields NW.js ignores.
|
|
974
|
+
*/
|
|
975
|
+
interface Manifest {
|
|
976
|
+
/**
|
|
977
|
+
* Which HTML page should be opened or which JavaScript file should be executed when NW.js starts.
|
|
978
|
+
*/
|
|
979
|
+
main: string;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* The name of the package. Must be a unique, lowercase alpha-numeric name without spaces (may include `.`, `_` or `-`).
|
|
983
|
+
*/
|
|
984
|
+
name: string;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* (Optional) Use it to rename the Helper application under macOS.
|
|
988
|
+
*/
|
|
989
|
+
product_string?: string | undefined;
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* (Optional) Set to `false` to disable Node support in NW.js.
|
|
993
|
+
*/
|
|
994
|
+
nodejs?: boolean | undefined;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* (Optional) Path to a Node.js script file, executed on startup in Node context before the first DOM window loads.
|
|
998
|
+
*/
|
|
999
|
+
"node-main"?: string | undefined;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* (Optional) The host in the `chrome-extension://` protocol URL used for the application.
|
|
1003
|
+
*/
|
|
1004
|
+
domain?: string | undefined;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* (Optional) Whether to start up a single instance of the app. `true` by default.
|
|
1008
|
+
*
|
|
1009
|
+
* @deprecated since version 0.13.0
|
|
1010
|
+
*/
|
|
1011
|
+
"single-instance"?: boolean | undefined;
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* (Optional) Background script, executed in the background page at app start.
|
|
1015
|
+
*/
|
|
1016
|
+
"bg-script"?: string | undefined;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* (Optional) Controls how the window looks. See `WindowOption`.
|
|
1020
|
+
*/
|
|
1021
|
+
window?: WindowOption | undefined;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* (Optional) Controls what features of WebKit should be on/off.
|
|
1025
|
+
*/
|
|
1026
|
+
webkit?: WebkitOption | undefined;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* (Optional) Overrides the `User-Agent` header in HTTP requests made from the application.
|
|
1030
|
+
* Supports `%name`, `%ver`, `%nwver`, `%webkit_ver`, `%chromium_ver` and `%osinfo` placeholders.
|
|
1031
|
+
*/
|
|
1032
|
+
"user-agent"?: string | undefined;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* (Optional) Enables calling Node in remote pages. Value(s) follow Chrome extension match patterns.
|
|
1036
|
+
*/
|
|
1037
|
+
"node-remote"?: string | string[] | undefined;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* (Optional) Chromium (content shell) command line arguments.
|
|
1041
|
+
*/
|
|
1042
|
+
"chromium-args"?: string | undefined;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* (Optional) URL of the crash report server.
|
|
1046
|
+
*/
|
|
1047
|
+
crash_report_url?: string | undefined;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* (Optional) Flags passed to the JS engine (v8).
|
|
1051
|
+
*/
|
|
1052
|
+
"js-flags"?: string | undefined;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* (Optional) Local filename, relative to the application path, of a script injected after CSS but before other DOM/script.
|
|
1056
|
+
*/
|
|
1057
|
+
inject_js_start?: string | undefined;
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* (Optional) Local filename, relative to the application path, of a script injected after the document loads, before `onload`.
|
|
1061
|
+
*/
|
|
1062
|
+
inject_js_end?: string | undefined;
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* (Optional) List of PEM-encoded certificates used as additional root certificates for validation.
|
|
1066
|
+
*/
|
|
1067
|
+
additional_trust_anchors?: string[] | undefined;
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* (Optional) Number of megabytes for the quota of the DOM storage.
|
|
1071
|
+
*/
|
|
1072
|
+
dom_storage_quota?: number | undefined;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* (Optional, Mac) Whether the default `Edit` menu should be disabled. `false` by default.
|
|
1076
|
+
*
|
|
1077
|
+
* @deprecated since version 0.13.0
|
|
1078
|
+
*/
|
|
1079
|
+
"no-edit-menu"?: boolean | undefined;
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* (Optional) Permissions granted to `<webview>` tags, keyed by storage partition.
|
|
1083
|
+
* A webview using one of these partitions (via its `partition` attribute) can load
|
|
1084
|
+
* the listed resources and be used as a trusted DevTools container.
|
|
1085
|
+
*/
|
|
1086
|
+
webview?: WebviewManifestOption | undefined;
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* NW.js only reads the fields above; any other `package.json` field (e.g. `dependencies`, `scripts`) is preserved as-is.
|
|
1090
|
+
*/
|
|
1091
|
+
[key: string]: any;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* `webview` manifest field. Grants extra permissions to `<webview>` partitions.
|
|
1096
|
+
*/
|
|
1097
|
+
interface WebviewManifestOption {
|
|
1098
|
+
/**
|
|
1099
|
+
* (Optional) The list of storage partitions and the resources each may access.
|
|
1100
|
+
*/
|
|
1101
|
+
partitions?: WebviewPartition[] | undefined;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* A single entry of `Manifest.webview.partitions`.
|
|
1106
|
+
*/
|
|
1107
|
+
interface WebviewPartition {
|
|
1108
|
+
/**
|
|
1109
|
+
* The name of the partition, matched against the `partition` attribute of a `<webview>` tag.
|
|
1110
|
+
*/
|
|
1111
|
+
name: string;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* (Optional) Resources the partition is allowed to load, following Chrome extension
|
|
1115
|
+
* match patterns. e.g. `["<all_urls>"]`.
|
|
1116
|
+
*/
|
|
1117
|
+
accessible_resources?: string[] | undefined;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* `webkit` manifest subfield, controls what features of WebKit should be on/off.
|
|
1122
|
+
*/
|
|
1123
|
+
interface WebkitOption {
|
|
1124
|
+
/**
|
|
1125
|
+
* (Optional, Mac) Enable zooming with double tapping using 2 fingers. `false` by default.
|
|
1126
|
+
*/
|
|
1127
|
+
double_tap_to_zoom_enabled?: boolean | undefined;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* (Optional) Whether to load external browser plugins like Flash. `true` by default.
|
|
1131
|
+
*/
|
|
1132
|
+
plugin?: boolean | undefined;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
685
1135
|
/**
|
|
686
1136
|
* nw.Window Option that is in the same format as the Window subfields in manifest format.
|
|
687
1137
|
*/
|
|
@@ -691,6 +1141,13 @@ declare global {
|
|
|
691
1141
|
*/
|
|
692
1142
|
id?: string | undefined;
|
|
693
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* (Optional) Whether the navigation toolbar should be shown.
|
|
1146
|
+
*
|
|
1147
|
+
* @deprecated since version 0.13.0
|
|
1148
|
+
*/
|
|
1149
|
+
toolbar?: boolean | undefined;
|
|
1150
|
+
|
|
694
1151
|
/**
|
|
695
1152
|
* The default title of window created by NW.js
|
|
696
1153
|
*/
|
|
@@ -793,6 +1250,16 @@ declare global {
|
|
|
793
1250
|
*/
|
|
794
1251
|
new_instance?: boolean | undefined;
|
|
795
1252
|
|
|
1253
|
+
/**
|
|
1254
|
+
* (Optional) If true, the Node context and DOM context are merged in the new window's process. Use only when `new_instance` is true.
|
|
1255
|
+
*/
|
|
1256
|
+
mixed_context?: boolean | undefined;
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* (Optional) Whether the window should be focused when it's opened. `false` by default.
|
|
1260
|
+
*/
|
|
1261
|
+
focus?: boolean | undefined;
|
|
1262
|
+
|
|
796
1263
|
/**
|
|
797
1264
|
* (Optional) The script to be injected before document loaded.
|
|
798
1265
|
*/
|
|
@@ -819,6 +1286,54 @@ declare global {
|
|
|
819
1286
|
ignore(): void;
|
|
820
1287
|
}
|
|
821
1288
|
|
|
1289
|
+
/* webview Tag: http://docs.nwjs.io/en/latest/References/webview%20Tag/ */
|
|
1290
|
+
/**
|
|
1291
|
+
* The NW.js-specific additions to the `<webview>` tag.
|
|
1292
|
+
*
|
|
1293
|
+
* Only the methods NW.js adds on top of Chrome's `<webview>` are declared here; for the
|
|
1294
|
+
* upstream API surface, intersect this with the `<webview>` typings from `@types/chrome`:
|
|
1295
|
+
* `document.getElementById("foo") as chrome.webviewTag.WebViewElement & NWJS_Helpers.webview`
|
|
1296
|
+
*/
|
|
1297
|
+
interface webview extends HTMLElement {
|
|
1298
|
+
/**
|
|
1299
|
+
* Open or close the DevTools window for the guest contents.
|
|
1300
|
+
*
|
|
1301
|
+
* @param show {boolean} Whether to open or close the devtools window.
|
|
1302
|
+
* @param container {HTMLElement} (Optional) the `<webview>` element used to display the
|
|
1303
|
+
* DevTools. By default the DevTools is shown in a new window. The container webview must
|
|
1304
|
+
* be trusted, i.e. its `partition` must be listed in the `webview` field of the manifest.
|
|
1305
|
+
*/
|
|
1306
|
+
showDevTools(show: boolean, container?: HTMLElement): void;
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Inspect the element located at (`x`, `y`). Only meaningful after the DevTools has been
|
|
1310
|
+
* opened with `webview.showDevTools()`.
|
|
1311
|
+
*
|
|
1312
|
+
* @param x {number} The x coordinate of the element to inspect.
|
|
1313
|
+
* @param y {number} The y coordinate of the element to inspect.
|
|
1314
|
+
*/
|
|
1315
|
+
inspectElementAt(x: number, y: number): void;
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* Get the id of the cookie store of the guest contents, to be used as `storeId` in the
|
|
1319
|
+
* `chrome.cookies` API.
|
|
1320
|
+
*
|
|
1321
|
+
* @returns {string} The cookie store id.
|
|
1322
|
+
*/
|
|
1323
|
+
getCookieStoreId(): string;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Extra field NW.js accepts in the `InjectDetails` of `webview.executeScript()`.
|
|
1328
|
+
*/
|
|
1329
|
+
interface WebviewInjectDetails {
|
|
1330
|
+
/**
|
|
1331
|
+
* (Optional) Inject the code into the main world context instead of an isolated world,
|
|
1332
|
+
* so it can access JS objects of the target DOM context.
|
|
1333
|
+
*/
|
|
1334
|
+
mainWorld?: boolean | undefined;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
822
1337
|
interface win extends EventEmitter {
|
|
823
1338
|
/**
|
|
824
1339
|
* Get the corresponding DOM window object of the native window.
|
|
@@ -851,9 +1366,16 @@ declare global {
|
|
|
851
1366
|
title: string;
|
|
852
1367
|
|
|
853
1368
|
/**
|
|
854
|
-
* Get or set window's menubar.
|
|
1369
|
+
* Get or set window's menubar. Set with a Menu with type `menubar`.
|
|
1370
|
+
* When set to `null`, the menubar is completely removed for Windows and Linux,
|
|
1371
|
+
* and the menubar is cleared out on Mac.
|
|
855
1372
|
*/
|
|
856
|
-
menu: nw.Menu;
|
|
1373
|
+
menu: nw.Menu | null;
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Get whether the window is always on top of other windows.
|
|
1377
|
+
*/
|
|
1378
|
+
isAlwaysOnTop: boolean;
|
|
857
1379
|
|
|
858
1380
|
/**
|
|
859
1381
|
* Get whether we're in fullscreen mode.
|
|
@@ -904,6 +1426,20 @@ declare global {
|
|
|
904
1426
|
*/
|
|
905
1427
|
resizeTo(width: number, height: number): void;
|
|
906
1428
|
|
|
1429
|
+
/**
|
|
1430
|
+
* Sets the inner width of the window.
|
|
1431
|
+
*
|
|
1432
|
+
* @param width {Integer} The inner width of the window
|
|
1433
|
+
*/
|
|
1434
|
+
setInnerWidth(width: number): void;
|
|
1435
|
+
|
|
1436
|
+
/**
|
|
1437
|
+
* Sets the inner height of the window.
|
|
1438
|
+
*
|
|
1439
|
+
* @param height {Integer} The inner height of the window
|
|
1440
|
+
*/
|
|
1441
|
+
setInnerHeight(height: number): void;
|
|
1442
|
+
|
|
907
1443
|
/**
|
|
908
1444
|
* Resizes a window by the specified amount.
|
|
909
1445
|
*
|
|
@@ -961,6 +1497,13 @@ declare global {
|
|
|
961
1497
|
*/
|
|
962
1498
|
maximize(): void;
|
|
963
1499
|
|
|
1500
|
+
/**
|
|
1501
|
+
* Unmaximize the window, i.e. the reverse of `maximize()`.
|
|
1502
|
+
*
|
|
1503
|
+
* @deprecated since version 0.13. Replaced by the `restore` event.
|
|
1504
|
+
*/
|
|
1505
|
+
unmaximize(): void;
|
|
1506
|
+
|
|
964
1507
|
/**
|
|
965
1508
|
* Minimize the window to task bar on Windows, iconify the window on GTK, and miniaturize the window on Mac OS X.
|
|
966
1509
|
*/
|
|
@@ -1001,6 +1544,21 @@ declare global {
|
|
|
1001
1544
|
*/
|
|
1002
1545
|
toggleKioskMode(): void;
|
|
1003
1546
|
|
|
1547
|
+
/**
|
|
1548
|
+
* Turn on/off the transparency support.
|
|
1549
|
+
*
|
|
1550
|
+
* @deprecated since version 0.13.
|
|
1551
|
+
* @param transparent {boolean} Whether to set the window to be transparent
|
|
1552
|
+
*/
|
|
1553
|
+
setTransparent(transparent: boolean): void;
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Turn the window's native shadow on/off. Useful for frameless, transparent windows. (Mac)
|
|
1557
|
+
*
|
|
1558
|
+
* @param shadow {boolean} Whether the window has a shadow
|
|
1559
|
+
*/
|
|
1560
|
+
setShadow(shadow: boolean): void;
|
|
1561
|
+
|
|
1004
1562
|
/**
|
|
1005
1563
|
* Open the devtools to inspect the window.
|
|
1006
1564
|
*
|
|
@@ -1008,7 +1566,10 @@ declare global {
|
|
|
1008
1566
|
* @param callback {function(dev_win?)} callback with the native window of the DevTools window.
|
|
1009
1567
|
* - (optional) dev_win {window} Window object that you can use any properties and methods of Window except the events
|
|
1010
1568
|
*/
|
|
1011
|
-
showDevTools(
|
|
1569
|
+
showDevTools(
|
|
1570
|
+
iframe?: string | HTMLIFrameElement,
|
|
1571
|
+
callback?: (dev_win?: Window) => void,
|
|
1572
|
+
): void;
|
|
1012
1573
|
|
|
1013
1574
|
/**
|
|
1014
1575
|
* Close the devtools window.
|
|
@@ -1025,8 +1586,10 @@ declare global {
|
|
|
1025
1586
|
|
|
1026
1587
|
/**
|
|
1027
1588
|
* Query the status of devtools window.
|
|
1589
|
+
*
|
|
1590
|
+
* @since v0.92.0
|
|
1028
1591
|
*/
|
|
1029
|
-
isDevToolsOpen():
|
|
1592
|
+
isDevToolsOpen(callback: (status: boolean) => void): void;
|
|
1030
1593
|
|
|
1031
1594
|
/**
|
|
1032
1595
|
* Print the web contents in the window without the need for user’s interaction.
|
|
@@ -1105,7 +1668,27 @@ declare global {
|
|
|
1105
1668
|
* - (optional) arg {base64string|Buffer} Captured page data.
|
|
1106
1669
|
* @param config {string|CapturePageConfig} (Optional) Conig how captured page returned.
|
|
1107
1670
|
*/
|
|
1108
|
-
capturePage(
|
|
1671
|
+
capturePage(
|
|
1672
|
+
callback: (arg: string | Object) => void,
|
|
1673
|
+
config?: string | CapturePageConfig,
|
|
1674
|
+
): void;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Captures the window. It can be used to capture the full page beyond the visible area. To capture only the
|
|
1678
|
+
* visible area, see `win.capturePage`. When `callback` is omitted, a Promise is returned and it will resolve
|
|
1679
|
+
* with the `data` argument of the callback.
|
|
1680
|
+
*
|
|
1681
|
+
* @param options {CaptureScreenshotOptions} Options for the screenshot.
|
|
1682
|
+
* @param callback {function(err, data)} (Optional) The callback when finished capturing the window.
|
|
1683
|
+
* - err {string | null} `null` for success; a string with the error message for failure.
|
|
1684
|
+
* - data {string} base64 encoded image
|
|
1685
|
+
* @returns {Promise<string> | void} A promise resolving with the base64 encoded image, if `callback` is omitted.
|
|
1686
|
+
*/
|
|
1687
|
+
captureScreenshot(
|
|
1688
|
+
options: CaptureScreenshotOptions,
|
|
1689
|
+
callback: (err: string | null, data: string) => void,
|
|
1690
|
+
): void;
|
|
1691
|
+
captureScreenshot(options: CaptureScreenshotOptions): Promise<string>;
|
|
1109
1692
|
|
|
1110
1693
|
/**
|
|
1111
1694
|
* Show window progress bar.
|
|
@@ -1127,15 +1710,32 @@ declare global {
|
|
|
1127
1710
|
* @param frame {HTMLIFrameElement} The frame to execute in. If iframe is null, it assumes in current window / frame.
|
|
1128
1711
|
* @param script {string} The source code of the script to be executed
|
|
1129
1712
|
*/
|
|
1130
|
-
eval(frame: HTMLIFrameElement, script: string): void;
|
|
1713
|
+
eval(frame: HTMLIFrameElement | null, script: string): void;
|
|
1131
1714
|
|
|
1132
1715
|
/**
|
|
1133
1716
|
* Load and execute the compiled snapshot in the frame.
|
|
1134
1717
|
*
|
|
1135
1718
|
* @param frame {HTMLIFrameElement} The frame to execute in. If iframe is null, it assumes in current window / frame.
|
|
1136
|
-
* @param path {string} the path of the
|
|
1719
|
+
* @param path {string | ArrayBuffer | Buffer} the path or Buffer or ArrayBuffer of the binary file generated by nwjc
|
|
1720
|
+
*/
|
|
1721
|
+
evalNWBin(
|
|
1722
|
+
frame: HTMLIFrameElement | null,
|
|
1723
|
+
path: string | ArrayBuffer | Buffer,
|
|
1724
|
+
): void;
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* Load and execute the compiled binary for Modules in the frame. The binary should be compiled with `nwjc --nw-module`.
|
|
1728
|
+
* The module must be registered with `evalNWBinModule` before it is imported.
|
|
1729
|
+
*
|
|
1730
|
+
* @param frame {HTMLIFrameElement} The frame to execute in. If iframe is null, it assumes in current window / frame.
|
|
1731
|
+
* @param path {string | ArrayBuffer | Buffer} the path or Buffer or ArrayBuffer of the binary file generated by nwjc
|
|
1732
|
+
* @param module_path {string} the module URL related to the current document. It will be used to resolve the module specifier.
|
|
1137
1733
|
*/
|
|
1138
|
-
|
|
1734
|
+
evalNWBinModule(
|
|
1735
|
+
frame: HTMLIFrameElement | null,
|
|
1736
|
+
path: string | ArrayBuffer | Buffer,
|
|
1737
|
+
module_path: string,
|
|
1738
|
+
): void;
|
|
1139
1739
|
|
|
1140
1740
|
on(event: string, listener: Function): this;
|
|
1141
1741
|
|
|
@@ -1179,7 +1779,10 @@ declare global {
|
|
|
1179
1779
|
* @param listener {function(byCommandQ?)} The callback that handles the `document-start` event.
|
|
1180
1780
|
* - (optional) frame {HTMLIFrameElement|any} Is the iframe object, or null if the event is for the window..
|
|
1181
1781
|
*/
|
|
1182
|
-
on(
|
|
1782
|
+
on(
|
|
1783
|
+
event: "document-start",
|
|
1784
|
+
listener: (frame: HTMLIFrameElement | any) => any,
|
|
1785
|
+
): this;
|
|
1183
1786
|
|
|
1184
1787
|
/**
|
|
1185
1788
|
* Emitted when the document object in this window or a child iframe is unloaded, but before the onunload event is emitted.
|
|
@@ -1188,7 +1791,10 @@ declare global {
|
|
|
1188
1791
|
* @param listener {function(byCommandQ?)} The callback that handles the `document-end` event.
|
|
1189
1792
|
* - (optional) frame {HTMLIFrameElement|any} Is the iframe object, or null if the event is for the window..
|
|
1190
1793
|
*/
|
|
1191
|
-
on(
|
|
1794
|
+
on(
|
|
1795
|
+
event: "document-end",
|
|
1796
|
+
listener: (frame: HTMLIFrameElement | any) => any,
|
|
1797
|
+
): this;
|
|
1192
1798
|
|
|
1193
1799
|
/**
|
|
1194
1800
|
* Emitted when window gets focus.
|
|
@@ -1248,7 +1854,10 @@ declare global {
|
|
|
1248
1854
|
* - (optional) width {Integer} The new width of the window.
|
|
1249
1855
|
* - (optional) height {Integer} The new height of the window.
|
|
1250
1856
|
*/
|
|
1251
|
-
on(
|
|
1857
|
+
on(
|
|
1858
|
+
event: "resize",
|
|
1859
|
+
listener: (width?: number, height?: number) => any,
|
|
1860
|
+
): this;
|
|
1252
1861
|
|
|
1253
1862
|
/**
|
|
1254
1863
|
* Emitted when window enters fullscreen state.
|
|
@@ -1258,6 +1867,15 @@ declare global {
|
|
|
1258
1867
|
*/
|
|
1259
1868
|
on(event: "enter-fullscreen", listener: () => any): this;
|
|
1260
1869
|
|
|
1870
|
+
/**
|
|
1871
|
+
* Emitted when window leaves fullscreen state.
|
|
1872
|
+
*
|
|
1873
|
+
* @deprecated since version 0.13. Replaced by the `restore` event.
|
|
1874
|
+
* @param event {string} Event name
|
|
1875
|
+
* @param listener {function} The callback that handles the `leave-fullscreen` event.
|
|
1876
|
+
*/
|
|
1877
|
+
on(event: "leave-fullscreen", listener: () => any): this;
|
|
1878
|
+
|
|
1261
1879
|
/**
|
|
1262
1880
|
* Emitted when window zooming changed.
|
|
1263
1881
|
*
|
|
@@ -1267,6 +1885,29 @@ declare global {
|
|
|
1267
1885
|
*/
|
|
1268
1886
|
on(event: "zoom", listener: (zoom?: number) => any): this;
|
|
1269
1887
|
|
|
1888
|
+
/**
|
|
1889
|
+
* Emitted after the capturePage method is called and image data is ready.
|
|
1890
|
+
*
|
|
1891
|
+
* @deprecated since version 0.13. Use the callback with `win.capturePage()` instead.
|
|
1892
|
+
* @param event {string} Event name
|
|
1893
|
+
* @param listener {function(arg?)} The callback that handles the `capturepagedone` event.
|
|
1894
|
+
* - (optional) arg {string|Object} Captured page data.
|
|
1895
|
+
*/
|
|
1896
|
+
on(
|
|
1897
|
+
event: "capturepagedone",
|
|
1898
|
+
listener: (arg?: string | Object) => any,
|
|
1899
|
+
): this;
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Emitted when the DevTools window has been opened.
|
|
1903
|
+
*
|
|
1904
|
+
* @deprecated since version 0.13. Use the `callback` passed to `win.showDevTools()` instead.
|
|
1905
|
+
* @param event {string} Event name
|
|
1906
|
+
* @param listener {function(url?)} The callback that handles the `devtools-opened` event.
|
|
1907
|
+
* - (optional) url {string} URL of the DevTools window.
|
|
1908
|
+
*/
|
|
1909
|
+
on(event: "devtools-opened", listener: (url?: string) => any): this;
|
|
1910
|
+
|
|
1270
1911
|
/**
|
|
1271
1912
|
* Emitted after Devtools is closed.
|
|
1272
1913
|
*
|
|
@@ -1286,7 +1927,11 @@ declare global {
|
|
|
1286
1927
|
*/
|
|
1287
1928
|
on(
|
|
1288
1929
|
event: "new-win-policy",
|
|
1289
|
-
listener: (
|
|
1930
|
+
listener: (
|
|
1931
|
+
frame: HTMLIFrameElement | null,
|
|
1932
|
+
url: string,
|
|
1933
|
+
policy: WinPolicy,
|
|
1934
|
+
) => any,
|
|
1290
1935
|
): this;
|
|
1291
1936
|
|
|
1292
1937
|
/**
|
|
@@ -1300,7 +1945,11 @@ declare global {
|
|
|
1300
1945
|
*/
|
|
1301
1946
|
on(
|
|
1302
1947
|
event: "navigation",
|
|
1303
|
-
listener: (
|
|
1948
|
+
listener: (
|
|
1949
|
+
frame?: HTMLIFrameElement | any,
|
|
1950
|
+
url?: string,
|
|
1951
|
+
policy?: WinNavigationPolicy,
|
|
1952
|
+
) => any,
|
|
1304
1953
|
): this;
|
|
1305
1954
|
}
|
|
1306
1955
|
}
|
|
@@ -1323,8 +1972,9 @@ declare global {
|
|
|
1323
1972
|
|
|
1324
1973
|
/**
|
|
1325
1974
|
* Get a list of patterns of filtered command line arguments used by `App.argv`.
|
|
1975
|
+
* By default: `[/^--url=/, /^--remote-debugging-port=/, /^--renderer-cmd-prefix=/, /^--nwapp=/]`.
|
|
1326
1976
|
*/
|
|
1327
|
-
filteredArgv:
|
|
1977
|
+
filteredArgv: RegExp[];
|
|
1328
1978
|
|
|
1329
1979
|
/**
|
|
1330
1980
|
* Get the directory where the application starts. The application will change the current directory to where the package files reside after start.
|
|
@@ -1339,7 +1989,7 @@ declare global {
|
|
|
1339
1989
|
/**
|
|
1340
1990
|
* Get the json object of the manifest file.
|
|
1341
1991
|
*/
|
|
1342
|
-
manifest:
|
|
1992
|
+
manifest: NWJS_Helpers.Manifest;
|
|
1343
1993
|
|
|
1344
1994
|
/**
|
|
1345
1995
|
* Clear the HTTP cache in memory and the one on disk. This method call is synchronized.
|
|
@@ -1372,7 +2022,10 @@ declare global {
|
|
|
1372
2022
|
* @param component {string} ID of component; currently only `WIDEVINE` is supported.
|
|
1373
2023
|
* @param callback {(version: string) => void} Callback after the component is enabled; `version` string parameter is the version of the enabled component. ‘0.0.0.0’ means it’s not installed. Use `App.updateComponent()` to install it.
|
|
1374
2024
|
*/
|
|
1375
|
-
enableComponent(
|
|
2025
|
+
enableComponent(
|
|
2026
|
+
component: string,
|
|
2027
|
+
callback: (version: string) => void,
|
|
2028
|
+
): void;
|
|
1376
2029
|
|
|
1377
2030
|
/**
|
|
1378
2031
|
* Query the proxy to be used for loading `url` in DOM.
|
|
@@ -1453,7 +2106,10 @@ declare global {
|
|
|
1453
2106
|
* @param component {string} ID of component; currently only `WIDEVINE` is supported.
|
|
1454
2107
|
* @param callback {(success: boolean) => void} Callback after the component is updated; success is a boolean parameter for the update result.
|
|
1455
2108
|
*/
|
|
1456
|
-
updateComponent(
|
|
2109
|
+
updateComponent(
|
|
2110
|
+
component: string,
|
|
2111
|
+
callback: (success: boolean) => void,
|
|
2112
|
+
): void;
|
|
1457
2113
|
|
|
1458
2114
|
on(event: string, listener: Function): this;
|
|
1459
2115
|
|
|
@@ -1548,7 +2204,10 @@ declare global {
|
|
|
1548
2204
|
* @param appname {string} The application name
|
|
1549
2205
|
* @param options {Object} (Optional) Options to modify default `edit` and `window` MenuItems in Mac
|
|
1550
2206
|
*/
|
|
1551
|
-
createMacBuiltin(
|
|
2207
|
+
createMacBuiltin(
|
|
2208
|
+
appname: string,
|
|
2209
|
+
options?: NWJS_Helpers.CreateMacBuiltinOption,
|
|
2210
|
+
): void;
|
|
1552
2211
|
}
|
|
1553
2212
|
|
|
1554
2213
|
/* MenuItem: http://docs.nwjs.io/en/latest/References/MenuItem/ */
|
|
@@ -1586,7 +2245,7 @@ declare global {
|
|
|
1586
2245
|
/**
|
|
1587
2246
|
* Get or set the `tooltip` of a `MenuItem`
|
|
1588
2247
|
*/
|
|
1589
|
-
tooltip:
|
|
2248
|
+
tooltip: string;
|
|
1590
2249
|
|
|
1591
2250
|
/**
|
|
1592
2251
|
* Get or set whether the `MenuItem` is `checked`
|
|
@@ -1650,7 +2309,10 @@ declare global {
|
|
|
1650
2309
|
* @param callback {Function} callback function with chosed streamId.
|
|
1651
2310
|
* - (optional) streamId {string} streamId will be false if failed to execute or existing session is alive.
|
|
1652
2311
|
*/
|
|
1653
|
-
chooseDesktopMedia(
|
|
2312
|
+
chooseDesktopMedia(
|
|
2313
|
+
sources: string[],
|
|
2314
|
+
callback: (streamId?: string | boolean) => void,
|
|
2315
|
+
): void;
|
|
1654
2316
|
|
|
1655
2317
|
/**
|
|
1656
2318
|
* Use this API to monitor the changes of screens and windows on desktop. This is an instance of EventEmitter.
|
|
@@ -1666,7 +2328,10 @@ declare global {
|
|
|
1666
2328
|
* @param listener {Function(screen?)} The callback that handles the `displayBoundsChanged` event.
|
|
1667
2329
|
* - (optional) screen {screen} screen object
|
|
1668
2330
|
*/
|
|
1669
|
-
on(
|
|
2331
|
+
on(
|
|
2332
|
+
event: "displayBoundsChanged",
|
|
2333
|
+
listener: (screen: NWJS_Helpers.screen) => any,
|
|
2334
|
+
): this;
|
|
1670
2335
|
|
|
1671
2336
|
/**
|
|
1672
2337
|
* Emitted when a new screen added.
|
|
@@ -1675,7 +2340,10 @@ declare global {
|
|
|
1675
2340
|
* @param listener {Function(screen?)} The callback that handles the `displayAdded` event.
|
|
1676
2341
|
* - (optional) screen {screen} screen object
|
|
1677
2342
|
*/
|
|
1678
|
-
on(
|
|
2343
|
+
on(
|
|
2344
|
+
event: "displayAdded",
|
|
2345
|
+
listener: (screen: NWJS_Helpers.screen) => any,
|
|
2346
|
+
): this;
|
|
1679
2347
|
|
|
1680
2348
|
/**
|
|
1681
2349
|
* Emitted when existing screen removed.
|
|
@@ -1684,7 +2352,10 @@ declare global {
|
|
|
1684
2352
|
* @param listener {Function(screen?)} The callback that handles the `displayRemoved` event.
|
|
1685
2353
|
* - (optional) screen {screen} screen object
|
|
1686
2354
|
*/
|
|
1687
|
-
on(
|
|
2355
|
+
on(
|
|
2356
|
+
event: "displayRemoved",
|
|
2357
|
+
listener: (screen: NWJS_Helpers.screen) => any,
|
|
2358
|
+
): this;
|
|
1688
2359
|
}
|
|
1689
2360
|
|
|
1690
2361
|
/* Shell: http://docs.nwjs.io/en/latest/References/Shell/ */
|
|
@@ -1817,7 +2488,7 @@ declare global {
|
|
|
1817
2488
|
* @param event {string} Event name
|
|
1818
2489
|
* @param listener {Function} The callback that handles the `click` event.
|
|
1819
2490
|
*/
|
|
1820
|
-
on(event: "click
|
|
2491
|
+
on(event: "click", listener: () => any): this;
|
|
1821
2492
|
}
|
|
1822
2493
|
|
|
1823
2494
|
/* Window: http://docs.nwjs.io/en/latest/References/Window/ */
|
|
@@ -1854,14 +2525,54 @@ declare global {
|
|
|
1854
2525
|
): void;
|
|
1855
2526
|
}
|
|
1856
2527
|
|
|
2528
|
+
/* JavaScript Contexts: http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/ */
|
|
1857
2529
|
export function require(id: string): any;
|
|
1858
2530
|
|
|
2531
|
+
/**
|
|
2532
|
+
* The global object of the Node context. Same as `global` in the browser context.
|
|
2533
|
+
*/
|
|
2534
|
+
export var global: typeof globalThis;
|
|
2535
|
+
|
|
2536
|
+
/**
|
|
2537
|
+
* The `process` module of Node.js. Same as `process` in the browser context.
|
|
2538
|
+
*/
|
|
2539
|
+
export var process: NodeJS.Process;
|
|
2540
|
+
|
|
1859
2541
|
export var App: App;
|
|
1860
2542
|
export var Clipboard: Clipboard;
|
|
1861
2543
|
export var Screen: Screen;
|
|
1862
2544
|
export var Shell: Shell;
|
|
1863
2545
|
export var Window: Window;
|
|
1864
2546
|
}
|
|
2547
|
+
|
|
2548
|
+
/* Changes to Node: http://docs.nwjs.io/en/latest/References/Changes%20to%20Node/ */
|
|
2549
|
+
namespace NodeJS {
|
|
2550
|
+
interface ProcessVersions {
|
|
2551
|
+
/**
|
|
2552
|
+
* NW.js's version.
|
|
2553
|
+
*/
|
|
2554
|
+
nw: string;
|
|
2555
|
+
|
|
2556
|
+
/**
|
|
2557
|
+
* The Chromium version which NW.js is based on.
|
|
2558
|
+
*/
|
|
2559
|
+
chromium: string;
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* `"sdk"` when the binary is a SDK build, or `"normal"` when the binary is a normal build.
|
|
2563
|
+
*/
|
|
2564
|
+
"nw-flavor": "sdk" | "normal";
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
/* Changes to DOM: http://docs.nwjs.io/en/latest/References/Changes%20to%20DOM/ */
|
|
2569
|
+
interface File {
|
|
2570
|
+
/**
|
|
2571
|
+
* NW.js only. The native path of the selected file.
|
|
2572
|
+
* Only available in Node frames.
|
|
2573
|
+
*/
|
|
2574
|
+
readonly path: string;
|
|
2575
|
+
}
|
|
1865
2576
|
}
|
|
1866
2577
|
|
|
1867
2578
|
declare module "nw.gui" {
|
nw.js/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/nw.js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.115.0",
|
|
4
4
|
"description": "TypeScript definitions for nw.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nw.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@types/node": "*"
|
|
29
29
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"peerDependencies": {},
|
|
31
|
+
"typesPublisherContentHash": "aa2950b9f0564f2b0f11dc428204ce2e72f525ed63348b88c553f15bd4be2e5c",
|
|
32
|
+
"typeScriptVersion": "5.6",
|
|
32
33
|
"nonNpm": true
|
|
33
34
|
}
|