generated from OlegWock/webpack-react-web-extension-template
-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
declarations.d.ts
87 lines (72 loc) · 2.64 KB
/
declarations.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import 'webextension-polyfill';
/* eslint-disable @typescript-eslint/no-unused-vars */
declare module 'webextension-polyfill' {
namespace DeclarativeNetRequest {
interface Static {
MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES: number;
}
}
namespace Storage {
interface Static {
session: StorageArea;
}
}
namespace Manifest {
interface WebExtensionManifestWebAccessibleResourcesC2ItemType {
use_dynamic_url?: boolean;
}
interface WebExtensionManifest {
optional_host_permissions?: MatchPattern[];
browser_url_overrides?: WebExtensionManifestChromeUrlOverridesType;
}
}
namespace Tabs {
interface Static {
group: (options: { createProperties?: { windowId?: number }, groupId?: number, tabIds?: number | number[] }) => Promise<number>
}
}
}
declare global {
type FileSystemDirectoryNamesIterator = AsyncIterable<string>;
type FileSystemDirectoryHandlesIterator = AsyncIterable<FileSystemDirectoryHandle | FileSystemFileHandle>;
type FileSystemDirectoryEntriesIterator = AsyncIterable<[string, FileSystemDirectoryHandle | FileSystemFileHandle]>;
interface FileSystemDirectoryHandle {
keys(): FileSystemDirectoryNamesIterator,
values(): FileSystemDirectoryHandlesIterator,
entries(): FileSystemDirectoryEntriesIterator,
}
interface FileSystemSyncAccessHandle {
write(buf: ArrayBuffer | ArrayBufferView, opt?: { at: number }): number, // MDN says it's actually Promise, but that seem to be typo
flush(): void,
close(): void,
}
interface FileSystemFileHandle {
createWritable(): Promise<FileSystemWritableFileStream>,
createSyncAccessHandle(): Promise<FileSystemSyncAccessHandle>,
}
type TabGroupColor = "grey" | "blue" | "red" | "yellow" | "green" | "pink" | "purple" | "cyan" | "orange";
interface TabGroup {
collapsed: boolean;
color: TabGroupColor;
id: number;
windowId: number;
title?: string;
}
interface ChromeTabGroupsStatic {
update: (
groupId: number,
updateProperties: { collapsed?: boolean; color?: TabGroupColor; title?: string }
) => Promise<TabGroup | undefined>;
}
interface ChromeTabsStatic {
group: (options: {
createProperties?: { windowId?: number };
groupId?: number;
tabIds?: number | number[];
}) => Promise<number>;
}
type ChromeBrowserAdditions = {
tabGroups: ChromeTabGroupsStatic;
tabs: ChromeTabsStatic;
};
}