File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference types="firefox-webext-browser" />
2
+
3
+ /**
4
+ * Same as `addToTab`, but it will automatically listen to new tabs and inject the scripts as needed.
5
+ *
6
+ * @param contentScripts {string[]} An array of content scripts.
7
+ */
8
+ export function addToFutureTabs ( contentScripts ?: string [ ] ) : Promise < void > ;
9
+
10
+ /**
11
+ * This is an advanced version of `chrome.tabs.executeScript`/`chrome.tabs.insertCSS`:
12
+ * - It accepts a mixed JS/CSS object just like in `manifest.json`.
13
+ *
14
+ * @param tab {browser.tabs.Tab|number} Tab or tab ID to add the content scripts to.
15
+ * @param contentScripts {string[]} An array of content scripts.
16
+ *
17
+ * @example
18
+ * DCS.addToTab(tab, {
19
+ * run_at: 'document_start',
20
+ * all_frames: true,
21
+ * css: [
22
+ * 'content.css'
23
+ * ],
24
+ * js: [
25
+ * 'webext-dynamic-content-scripts.js',
26
+ * 'jquery.slim.min.js',
27
+ * 'browser-polyfill.min.js',
28
+ * 'content.js'
29
+ * ]
30
+ * // Not supported: all matches and globs properties
31
+ * });
32
+ */
33
+ export function addToTab ( tab : browser . tabs . Tab | number , contentScripts ?: string [ ] ) : Promise < void > ;
Original file line number Diff line number Diff line change 21
21
"main" : " dist/webext-dynamic-content-scripts.js" ,
22
22
"files" : [
23
23
" src" ,
24
- " dist"
24
+ " dist" ,
25
+ " index.d.ts"
25
26
],
26
27
"scripts" : {
27
28
"watch:xo" : " onchange 'src/*.js' --initial -- xo --fix" ,
40
41
"webext-content-script-ping" : " ^2.0.1"
41
42
},
42
43
"devDependencies" : {
44
+ "@types/firefox-webext-browser" : " ^65.0.0" ,
43
45
"onchange" : " ^3.2.0" ,
44
46
"rollup" : " ^0.41.6" ,
45
47
"rollup-config-webext" : " ^1.1.0" ,
You can’t perform that action at this time.
0 commit comments