{"id":13850724,"url":"https://github.com/sentialx/electron-extensions","last_synced_at":"2025-07-12T23:30:24.958Z","repository":{"id":49209412,"uuid":"186693363","full_name":"sentialx/electron-extensions","owner":"sentialx","description":"Implementation of Chrome extension APIs for Electron","archived":true,"fork":false,"pushed_at":"2021-06-23T13:55:46.000Z","size":499,"stargazers_count":185,"open_issues_count":8,"forks_count":28,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-21T23:01:54.498Z","etag":null,"topics":["api","chrome","electron","extensions","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sentialx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["sentialx"],"patreon":"sentialx","custom":"https://paypal.me/sentialx"}},"created_at":"2019-05-14T20:13:46.000Z","updated_at":"2024-11-20T07:16:25.000Z","dependencies_parsed_at":"2022-08-12T20:01:09.283Z","dependency_job_id":null,"html_url":"https://github.com/sentialx/electron-extensions","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentialx%2Felectron-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentialx%2Felectron-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentialx%2Felectron-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sentialx%2Felectron-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sentialx","download_url":"https://codeload.github.com/sentialx/electron-extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225844875,"owners_count":17533160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","chrome","electron","extensions","typescript"],"created_at":"2024-08-04T20:01:28.318Z","updated_at":"2024-11-22T04:30:18.003Z","avatar_url":"https://github.com/sentialx.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sentialx","https://patreon.com/sentialx","https://paypal.me/sentialx"],"categories":["TypeScript"],"sub_categories":[],"readme":"# electron-extensions\n\n`electron-extensions` will allow you to use Chrome extensions APIs with Electron.\n\n# Installation\n\n```bash\n$ npm install electron-extensions\n```\n\n# Usage\n\nThe library is really easy-to-use. All you have to do is to put the following code in your main process:\n\n```typescript\nimport { ExtensibleSession } from 'electron-extensions/main';\nimport { app } from 'electron';\n\nconst extensions = new ExtensibleSession();\n\n(async () =\u003e {\n  await app.whenReady();\n  extensions.loadExtension('C:/.../abcdefghijklmnoprstuwxyz'); // Path to the extension to load\n})();\n```\n\n# Documentation\n\n## Class `ExtensibleSession` `main`\n\n### `new ExtensibleSession(options: IOptions)`\n\n- `options` object\n  - `partition` string - By default `null`. It's used for injecting preloads to\n    load `content_scripts` in all webContents within a given Electron `session`. Must be called in `app` `ready` event.\n  - `preloadPath` string - Path to content preload script. The option can be useful for bundlers like `webpack` if you're using `CopyWebpackPlugin`.\n  - `blacklist` string[] - List of URLs or glob patterns preventing from injecting `content_scripts` to. For example `[wexond://*/*]`.\n\nIt's only for the main process. It's used to load extensions and handle their events.\n\n### Instance methods\n\n#### `loadExtension(path: string)`\n\nLoads an extension from a given path.\n\n#### `addWindow(window: Electron.BrowserWindow)`\n\nAdds a BrowserWindow to send and observe UI related events such as\n\n- `chrome.browserAction.onClicked`\n\n### Instance properties\n\n#### `blacklist` string[]\n\nList of URLs or glob patterns preventing from injecting `content_scripts` to. For example `[wexond://*]`.\n\n### Events\n\n#### `set-badge-text`\n\nEmitted when `chrome.browserAction.setBadgeText` has been called in an extension.\n\nReturns:\n\n- `extensionId` string\n- `details` chrome.browserAction.BadgeTextDetails\n\n#### `create-tab`\n\nEmitted when `chrome.tabs.create` has been called in an extension.\n\n##### Example:\n\n```typescript\nimport { extensionsRenderer } from 'electron-extensions';\n\nextensionsRenderer.on('create-tab', (details, callback) =\u003e {\n  const tab = createTab(details); // Some create tab method...\n  callback(tab.id);\n});\n```\n\nReturns:\n\n- `details` chrome.tabs.CreateProperties\n- `callback` (tabId: number) =\u003e void - Must be called with the created tab id as an argument. Also, the `tabId` must be the same as any attached `webContents` id\n\n## Object `extensionsRenderer`\n\n### Usage in `renderer`\n\n```typescript\nimport { extensionsRenderer } from 'electron-extensions/renderer';\n```\n\n### Instance methods\n\n#### `browserAction.onClicked(extensionId: string, tabId: number)`\n\nEmits `chrome.browserAction.onClicked` event in a given extension.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsentialx%2Felectron-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsentialx%2Felectron-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsentialx%2Felectron-extensions/lists"}