File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
packages/electron-chrome-extensions Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,11 @@ module.exports = {
153153 - ` removeWindow(browserWindow) => Promise<Electron.BrowserWindow> `
154154 (optional) - Called when ` chrome.windows.remove ` is invoked by an extension.
155155 - ` browserWindow ` Electron.BrowserWindow
156+ - ` assignTabDetails(details, webContents) => void ` (optional) - Called when ` chrome.tabs ` creates
157+ an object for tab details to be sent to an extension background script. Provide this function to
158+ assign custom details such as ` discarded ` , ` frozen ` , or ` groupId ` .
159+ - ` details ` [ chrome.tabs.Tab] ( https://developer.chrome.com/docs/extensions/reference/api/tabs#type-Tab )
160+ - ` webContents ` Electron.WebContents - The tab for which details are being created.
156161
157162``` ts
158163new ElectronChromeExtensions ({
@@ -438,6 +443,13 @@ See [Electron's Notification tutorial](https://www.electronjs.org/docs/tutorial/
438443- [ ] chrome.tabs.onReplaced
439444- [x] chrome.tabs.onZoomChange
440445
446+ > [ !NOTE]
447+ > Electron does not provide tab functionality such as discarded, frozen, or group IDs. If an
448+ > application developer wishes to implement this functionality, emit a ` "tab-updated" ` event on the
449+ > tab's WebContents for ` chrome.tabs.onUpdated ` to be made aware of changes. Tab properties can be
450+ > assigned using the ` assignTabDetails ` option provided to the ` ElectronChromeExtensions `
451+ > constructor.
452+
441453### [ ` chrome.webNavigation ` ] ( https://developer.chrome.com/extensions/webNavigation )
442454
443455- [x] chrome.webNavigation.getFrame (Electron 12+)
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ export class TabsAPI {
5656 'did-start-navigation' , // url
5757 'did-redirect-navigation' , // url
5858 'did-navigate-in-page' , // url
59+
60+ // Listen for 'tab-updated' to handle all other cases which don't have
61+ // an official Electron API such as discarded tabs. App developers can
62+ // emit this event to trigger chrome.tabs.onUpdated if a property has
63+ // changed.
64+ 'tab-updated' ,
5965 ]
6066
6167 const updateHandler = ( ) => {
You can’t perform that action at this time.
0 commit comments