dbrowser.panes
dBrowser includes the ability to split the page into multiple panes which navigate independently. This API gives applications the ability to "attach" to other panes and coordinate their browsing as well as inject JS/CSS.
Currently each pane can attach and manage one other pane at a time. The user must grant permission to use the panes API.
API
dbrowser.panes.setAttachable()
Mark the pane as "attachable." This will cause the attachment UI to display in the app's status bar, even if the pane is not attached to anything.
- Returns Void.
dbrowser.panes.getAttachedPane()
Get the currently attached pane. Returns undefined if no pane is attached.
- Returns Void|Object.
- id Number. The pane's identifier.
- url String. The pane's current location.
dbrowser.panes.attachToLastActivePane()
Attempts to attach to the pane that was active prior to the current pane. Can be used during setup to automatically attach to the pane in use.
Requires permission from the user.
- Returns Promise<Void|Object>.
- id Number. The pane's identifier.
- url String. The pane's current location.
dbrowser.panes.create(url, {attach: boolean})
Creates a new pane and optionally attaches to the pane automatically.
Requires permission from the user.
- url String. The URL to open in the new pane.
- opts Object.
- attach Boolean. Attach to the new pane. Defaults to false.
- Returns Promise<Object>.
- id Number. The pane's identifier.
- url String. The pane's current location.
dbrowser.panes.navigate(paneId, url)
Navigates the pane to the given URL. The given pane must be attached.
- paneId Number. The ID of the pane to navigate.
- url String. The URL to open in the target pane.
- Returns Promise<Void>.
dbrowser.panes.focus(paneId)
Gives focus to a different pane. The given pane must be attached.
- paneId Number. The ID of the pane to navigate.
- Returns Promise<Void>.
dbrowser.panes.executeJavaScript(paneId, script)
Runs the given javascript in a different pane. The given pane must be attached.
Requires permission from the user.
- paneId Number. The ID of the pane to navigate.
- script String. The script to execute.
- Returns Promise<Any>.
dbrowser.panes.injectCss(paneId, styles)
Inserts CSS into a different pane. The given pane must be attached.
Requires permission from the user.
- paneId Number. The ID of the pane to navigate.
- styles String. The styles to inject.
- Returns Promise<Number>. An ID which can be used to uninject the styles.
dbrowser.panes.uninjectCss(paneId, cssId)
Removes injected CSS from a pane. The given pane must be attached.
Requires permission from the user.
- paneId Number. The ID of the pane to navigate.
- cssId Number. The ID of the injected styles to remove.
- Returns Promise<Void>.
"pane-attached" event
Emitted when a pane has been attached to the current app.
- detail.id Number. The ID of the attached pane.
"pane-detached" event
Emitted when a pane has been detached from the current app.
"pane-navigated" event
Emitted when the attached pane has changed its current location.
- detail.url String. The new URL of the attached pane.
Example app
This example app can help you familiarize with the panes API.