Skip to content

Commit fdba386

Browse files
committed
docs: electron-chrome-web-store API
1 parent 8044fac commit fdba386

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

packages/electron-chrome-web-store/README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,63 @@ Install and manage Chrome extensions from the Chrome Web Store.
88
const { app, BrowserWindow, session } = require('electron')
99
const { installChromeWebStore } = require('electron-chrome-web-store')
1010

11-
(async function main() {
11+
async function main() {
1212
await app.whenReady()
1313

1414
const browserSession = session.defaultSession
1515
const browserWindow = new BrowserWindow({
1616
webPreferences: {
17-
session: browserSession
18-
}
17+
session: browserSession,
18+
},
1919
})
2020

2121
installChromeWebStore({ session: browserSession })
2222

2323
browserWindow.loadURL('https://chromewebstore.google.com/')
24-
}())
24+
}
25+
26+
main()
2527
```
2628

2729
To enable full support for Chrome extensions in Electron, install [electron-chrome-extensions](https://www.npmjs.com/package/electron-chrome-extensions).
2830

31+
## API
32+
33+
### `installChromeWebStore`
34+
35+
Installs Chrome Web Store support in the specified session.
36+
37+
- `options`: An object with the following properties:
38+
- `session`: The Electron session to enable the Chrome Web Store in. Defaults to `session.defaultSession`.
39+
- `modulePath`: The path to the 'electron-chrome-web-store' module.
40+
- `extensionsPath`: The path to the extensions directory. Defaults to 'Extensions/' under the app's userData path.
41+
- `loadExtensions`: A boolean indicating whether to load extensions installed by Chrome Web Store. Defaults to true.
42+
- `allowUnpackedExtensions`: A boolean indicating whether to allow loading unpacked extensions. Only loads if `loadExtensions` is also enabled. Defaults to false.
43+
- `allowlist`: An array of allowed extension IDs to install.
44+
- `denylist`: An array of denied extension IDs to install.
45+
46+
### `loadAllExtensions`
47+
48+
Loads all extensions from the specified directory.
49+
50+
- `session`: The Electron session to load extensions in.
51+
- `extensionsPath`: The path to the directory containing the extensions.
52+
- `options`: An object with the following property:
53+
- `allowUnpacked`: A boolean indicating whether to allow loading unpacked extensions. Defaults to false.
54+
55+
> [!NOTE] \
56+
> `installChromeWebStore` will automatically load installed extensions as long as the `loadExtensions` property is set to `true`.
57+
58+
### `downloadExtension`
59+
60+
Downloads an extension from the Chrome Web Store to the specified destination directory.
61+
62+
- `extensionId`: The ID of the extension to download.
63+
- `destDir`: The destination directory where the extension will be downloaded. The directory is expected to exist.
64+
65+
> [!TIP]
66+
> This API is designed to work in Node or Electron.
67+
2968
## License
3069

3170
MIT

0 commit comments

Comments
 (0)