Methods
(async, static) create(options) → {Promise.<View>}
Creates a new View.
Parameters:
Name | Type | Description |
---|---|---|
options |
View~options | View creation options |
- Tutorials:
Returns:
- Type
- Promise.<View>
(static) getCurrent() → {Promise.<View>}
Asynchronously returns a View object that represents the current view
- Tutorials:
Returns:
- Type
- Promise.<View>
(static) getCurrentSync() → {View}
Synchronously returns a View object that represents the current view
- Tutorials:
Returns:
- Type
- View
(async, static) wrap(identity) → {Promise.<View>}
Asynchronously returns a View object that represents an existing view.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- Promise.<View>
(static) wrapSync(identity) → {View}
Synchronously returns a View object that represents an existing view.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- View
attach(target) → {Promise.<void>}
Attaches the current view to a the given window identity. Identity must be the identity of a window in the same application. This detaches the view from its current window, and sets the view to be destroyed when its new window closes.
Parameters:
Name | Type | Description |
---|---|---|
target |
Identity |
- Tutorials:
Returns:
- Type
- Promise.<void>
capturePage(optionsopt) → {Promise.<string>}
Gets a base64 encoded image of the view or a part of it.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
CapturePageOptions |
<optional> |
Options for the capturePage call. |
- Tutorials:
Returns:
- Type
- Promise.<string>
destroy() → {Promise.<void>}
Destroys the current view
- Tutorials:
Returns:
- Type
- Promise.<void>
executeJavaScript(code) → {Promise.<void>}
Executes Javascript on the view, restricted to contents you own or contents owned by applications you have created.
Parameters:
Name | Type | Description |
---|---|---|
code |
string | JavaScript code to be executed on the view. |
- Tutorials:
Returns:
- Type
- Promise.<void>
findInPage(searchTerm, options) → {Promise.<number>}
Find and highlight text on a page.
Parameters:
Name | Type | Description |
---|---|---|
searchTerm |
string | Term to find in page |
options |
FindInPageOptions | Search options |
- Tutorials:
Returns:
- Type
- Promise.<number>
focus() → {Promise.<void>}
Focuses the view
- Tutorials:
Fires:
- event:focused
Returns:
- Type
- Promise.<void>
getBounds() → {Promise.<ViewBounds>}
Gets the bounds (top, left, width, height) of the view relative to its window.
- Tutorials:
Returns:
- Type
- Promise.<ViewBounds>
getCurrentWindow() → {Promise.<_Window>}
Retrieves the window the view is currently attached to.
Returns:
- Type
- Promise.<_Window>
getInfo() → {Promise.<ViewInfo>}
Gets the View's info.
- Tutorials:
Returns:
- Type
- Promise.<ViewInfo>
getOptions() → {Promise.<ViewOptions>}
Gets the View's options.
- Tutorials:
Returns:
- Type
- Promise.<ViewOptions>
getParentLayout() → {Promise.<Layout>}
Retrieves the layout for the window the view is attached to.
- Tutorials:
Returns:
- Type
- Promise.<Layout>
getPrinters() → {Promise.Array.<PrinterInfo>}
Returns an array with all system printers
- Tutorials:
Returns:
- Type
- Promise.Array.<PrinterInfo>
getProcessInfo() → {Promise.<EntityProcessDetails>}
Retrieves the process information associated with a view.
- Tutorials:
Returns:
- Type
- Promise.<EntityProcessDetails>
getSharedWorkers() → {Promise.Array.<SharedWorkerInfo>}
Retrieves information on all Shared Workers.
- Tutorials:
Returns:
- Type
- Promise.Array.<SharedWorkerInfo>
getZoomLevel() → {Promise.<number>}
Returns the zoom level of the view.
- Tutorials:
Returns:
- Type
- Promise.<number>
hide() → {Promise.<void>}
Hides the current view if it is currently visible.
- Tutorials:
Returns:
- Type
- Promise.<void>
inspectServiceWorker() → {Promise.<void>}
Opens the developer tools for the service worker context.
- Tutorials:
Returns:
- Type
- Promise.<void>
inspectSharedWorker() → {Promise.<void>}
Opens the developer tools for the shared worker context.
- Tutorials:
Returns:
- Type
- Promise.<void>
inspectSharedWorkerById(workerId) → {Promise.<void>}
Inspects the shared worker based on its ID.
Parameters:
Name | Type | Description |
---|---|---|
workerId |
string | The id of the shared worker. |
- Tutorials:
Returns:
- Type
- Promise.<void>
navigate(url) → {Promise.<void>}
Navigates the view to a specified URL. The url must contain the protocol prefix such as http:// or https://.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to navigate the view to. |
- Tutorials:
Returns:
- Type
- Promise.<void>
navigateBack() → {Promise.<void>}
Navigates the view back one page.
- Tutorials:
Returns:
- Type
- Promise.<void>
navigateForward() → {Promise.<void>}
Navigates the view forward one page.
- Tutorials:
Returns:
- Type
- Promise.<void>
print(optionsopt) → {Promise.<void>}
Prints the view's web page
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
PrintOptions |
<optional> |
Printer Options |
- Tutorials:
Returns:
- Type
- Promise.<void>
reload() → {Promise.<void>}
Reloads the view current page
- Tutorials:
Returns:
- Type
- Promise.<void>
setBounds(bounds) → {Promise.<void>}
Sets the bounds (top, left, width, height) of the view relative to its window.
Parameters:
Name | Type | Description |
---|---|---|
bounds |
ViewBounds |
- Tutorials:
Returns:
- Type
- Promise.<void>
setZoomLevel(level) → {Promise.<void>}
Sets the zoom level of the view.
Parameters:
Name | Type | Description |
---|---|---|
level |
number | The zoom level |
- Tutorials:
Returns:
- Type
- Promise.<void>
show() → {Promise.<void>}
Shows the current view if it is currently hidden.
- Tutorials:
Returns:
- Type
- Promise.<void>
showDeveloperTools() → {Promise.<void>}
Shows the Chromium Developer Tools
- Tutorials:
Returns:
- Type
- Promise.<void>
showPopupWindow(options) → {Promise.<PopupResult>}
Shows a popup window. If the window this view is currently attached to has a popup open, closes it.
Parameters:
Name | Type | Description |
---|---|---|
options |
PopupOptions |
- Tutorials:
Returns:
- Type
- Promise.<PopupResult>
stopFindInPage(action) → {Promise.<void>}
Stops any findInPage call with the provided action.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | Action to execute when stopping a find in page: |
- Tutorials:
Returns:
- Type
- Promise.<void>
stopNavigation() → {Promise.<void>}
Stops any current navigation the view is performing.
- Tutorials:
Returns:
- Type
- Promise.<void>
triggerBeforeUnload() → {Promise.<boolean>}
Triggers the before-unload handler for the View, if one is set. Returns true
if the handler is trying to prevent the View from unloading, and false
if it isn't.
Only enabled when setting enableBeforeUnload: true in your View options. If this option is not enabled it will always return false.
- Tutorials:
Returns:
- Type
- Promise.<boolean>
updateOptions(options) → {Promise.<void>}
Updates the view's options.
Parameters:
Name | Type | Description |
---|---|---|
options |
Partial.<ViewOptions> |
- Tutorials:
Returns:
- Type
- Promise.<void>
Type Definitions
options
View creation options.
This is the options object required by View.create.
Note that name
and target
are the only required properties — albeit the url
property is usually provided as well
(defaults to "about:blank"
when omitted).
Type:
- object
Properties:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
experimental |
object |
<optional> |
Configurations for API injection. Properties
|
||||||||||||||||||||||||
api |
object |
<optional> |
Configurations for API injection. Properties
|
||||||||||||||||||||||||
autoResize |
object |
<optional> |
AutoResize options |
||||||||||||||||||||||||
bounds |
object |
<optional> |
initial bounds given relative to the window. |
||||||||||||||||||||||||
backgroundColor |
string |
<optional> |
"#FFF" | Updatable.
The view’s backfill color as a hexadecimal value. Not to be confused with the content background color
( |
|||||||||||||||||||||||
contentNavigation |
object |
<optional> |
Restrict navigation to URLs that match a whitelisted pattern. In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited. See here for more details. Properties
|
||||||||||||||||||||||||
contentRedirect |
object |
<optional> |
Restrict redirects to URLs that match a whitelisted pattern. In the lack of a whitelist, redirects to URLs that match a blacklisted pattern would be prohibited. See here for more details. Properties
|
||||||||||||||||||||||||
contextMenuSettings |
object |
<optional> |
Updatable. Configure the context menu when right-clicking on a view. Properties
|
||||||||||||||||||||||||
customData |
any |
<optional> |
"" | Updatable.
A field that the user can attach serializable data to be ferried around with the view options.
When omitted, the default value of this property is the empty string ( |
|||||||||||||||||||||||
customContext |
any |
<optional> |
"" | Updatable.
A field that the user can use to attach serializable data that will be saved when Platform.getSnapshot
is called.
When omitted, the default value of this property is the empty string ( |
|||||||||||||||||||||||
hotkeys |
Array.<object> |
<optional> |
[] | Updatable.
Defines the list of hotkeys that will be emitted as a Properties
|
|||||||||||||||||||||||
isClosable |
boolean |
<optional> |
true | Platforms Only. If false, the view will be persistent and can't be closed through
either UI or |
|||||||||||||||||||||||
name |
string | The name of the view. |
|||||||||||||||||||||||||
detachOnClose |
boolean |
<optional> |
false | Updatable. Platforms Only. If true, will hide and detach the View from the window for later use instead of closing, allowing the state of the View to be saved and the View to be immediately shown in a new Layout. |
|||||||||||||||||||||||
manifestUrl |
string |
<optional> |
Platforms Only. Url to a manifest that contains View Options. Properties other than manifestUrl can still be used but the properties in the manifest will take precedence if there is any collision. |
||||||||||||||||||||||||
preloadScripts |
Array.<preloadScript> |
<optional> |
Inheritable A list of scripts that are eval'ed before other scripts in the page. When omitted, inherits from the parent application. |
||||||||||||||||||||||||
preventDragOut |
boolean |
<optional> |
false | Platforms Only. If true, the tab of the view can't be dragged out of its host window. |
|||||||||||||||||||||||
processAffinity |
string |
<optional> |
<application uuid> | A string to attempt to group renderers together. Will only be used if pages are on the same origin. |
|||||||||||||||||||||||
target |
Identity |
<optional> |
The identity of the window this view should be attached to. |
||||||||||||||||||||||||
url |
string |
<optional> |
"about:blank" | The URL of the view. |
|||||||||||||||||||||||
uuid |
string |
<optional> |
<application uuid> | The |