• Back to io.Connect Browser docs
io.Connect Browser Documentation

API Reference Documentation

  • Back to io.Connect Browser docs
Press/
  • io.Connect Browser
  • App Management
  • App Preferences
  • Channels
  • Intents
  • Interop
  • Layouts
  • Notifications
  • Search
  • Shared Contexts
  • Themes
  • Widget
  • Windows
  • Workspaces

Windows

3.5.9

Using the Window Management API, your application can easily open and manipulate browser windows. This allows you to transform your traditional single-window web app into a multi-window native-like web application. The Window Management API enables applications to:

  • open multiple windows;
  • manipulate the position and size of opened windows;
  • pass context data upon opening new windows;
  • listen for and handle events related to opening and closing windows;

The Window Management API is accessible through the io.windows object.

APIobject

Methods

  • findById
  • list
  • my
  • onWindowAdded
  • onWindowGotFocus
  • onWindowLostFocus
  • onWindowRemoved
  • open

findByIdmethod

Signature

(id: string) => WebWindow

Description

Finds a window by ID.

Parameters

Name Type Required Description
id string

Window ID.

listmethod

Signature

() => WebWindow[]

mymethod

Signature

() => WebWindow

Description

Returns the current window.

onWindowAddedmethod

Signature

(callback: (window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when a new window is opened.

Parameters

Name Type Required Description
callback (window: WebWindow) => void

Callback function to handle the event. Receives the added window as a parameter. Returns an unsubscribe function.

onWindowGotFocusmethod

Signature

(callback: (window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when a window receives focus.

Parameters

Name Type Required Description
callback (window: WebWindow) => void

Callback function to handle the event. Receives the window instance as a parameter. Returns an unsubscribe function.

onWindowLostFocusmethod

Signature

(callback: (window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when a window loses focus.

Parameters

Name Type Required Description
callback (window: WebWindow) => void

Callback function to handle the event. Receives the window instance as a parameter. Returns an unsubscribe function.

onWindowRemovedmethod

Signature

(callback: (window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when a window is closed. For backwards compatibility, you can also use windowRemoved.

Parameters

Name Type Required Description
callback (window: WebWindow) => void

Callback function to handle the event. Receives the removed window as a parameter. Returns an unsubscribe function.

openmethod

Signature

(name: string, url: string, options?: Settings) => Promise<WebWindow>

Description

Opens a new IO Connect Browser Window.

Parameters

Name Type Required Description
name string

The name for the window

url string

The window URL.

options Settings

Options for creating a window.

Boundsobject

Properties

Property Type Default Required Description
height number
left number
top number
width number

Settingsobject

Properties

Property Type Default Required Description
context any

The initial window context. Accessible from {@link WebWindow#getContext}

height number 400

Window height.

left number 0

Distance of the top left window corner from the left edge of the screen.

relativeDirection Position "right"

Direction ("bottom", "top", "left", "right") of positioning the window relatively to the relativeTo window. Considered only if relativeTo is supplied.

relativeTo string

The ID of the window that will be used to relatively position the new window. Can be combined with relativeDirection.

top number 0

Distance of the top left window corner from the top edge of the screen.

width number 400

Window width.

WebWindowobject

Properties

Property Type Default Required Description
id string
isFocused boolean
name string

Methods

  • close
  • focus
  • getBounds
  • getChannel
  • getContext
  • getTitle
  • getURL
  • moveResize
  • moveTo
  • onChannelsChanged
  • onContextUpdated
  • onFocusChanged
  • resizeTo
  • setContext
  • setTitle
  • updateContext

closemethod

Signature

() => Promise<WebWindow>

Description

Closes the window

focusmethod

Signature

() => Promise<WebWindow>

Description

Attempts to activate and bring to foreground the window. It is possible to fail due to client browser settings.

getBoundsmethod

Signature

() => Promise<Bounds>

Description

Returns the current location and size of the window.

getChannelmethod

Signature

() => Promise<string>

Description

Retrieves the current Channel of the window, if any.

getContextmethod

Signature

() => Promise<any>

Description

Gets the current context object of the window.

getTitlemethod

Signature

() => Promise<string>

Description

Returns the title of the window.

getURLmethod

Signature

() => Promise<string>

Description

Gets the current URL of the window.

moveResizemethod

Signature

(dimension: Partial<Bounds>) => Promise<WebWindow>

Description

Sets new location and size for the window. The accepted settings are absolute.

Parameters

Name Type Required Description
dimension Partial<Bounds>

The object containing the desired absolute size and location.

moveTomethod

Signature

(top?: number, left?: number) => Promise<WebWindow>

Description

Sets a new location of the window. The accepted settings are relative.

Parameters

Name Type Required Description
top number

Relative distance top coordinates.

left number

Relative distance left coordinates.

onChannelsChangedmethod

Signature

(callback: (names: string[]) => void) => UnsubscribeFunction

Description

Notifies when the current Channels of the window have changed. Returns a function you can use to unsubscribe from the event.

Parameters

Name Type Required Description
callback (names: string[]) => void

Callback for handling the event. Receives the names of the current Channels as an argument.

onContextUpdatedmethod

Signature

(callback: (context: any, window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when a change to the window's context has been made.

Parameters

Name Type Required Description
callback (context: any, window: WebWindow) => void

The function which will be invoked when a change to the window's context happens. The function will be called with the new context and window as arguments.

onFocusChangedmethod

Signature

(callback: (window: WebWindow) => void) => UnsubscribeFunction

Description

Notifies when the window focus is changed.

Parameters

Name Type Required Description
callback (window: WebWindow) => void

Callback function to handle the event. Returns an unsubscribe function.

resizeTomethod

Signature

(width?: number, height?: number) => Promise<WebWindow>

Description

Sets a new size of the window. The accepted settings are relative.

Parameters

Name Type Required Description
width number

Relative width of the window.

height number

Relative height of the window.

setContextmethod

Signature

(context: any) => Promise<WebWindow>

Description

Sets new context for the window.

Parameters

Name Type Required Description
context any

The new context object for the window.

setTitlemethod

Signature

(title: string) => Promise<WebWindow>

Description

Sets a new title for the window

Parameters

Name Type Required Description
title string

The new title value.

updateContextmethod

Signature

(context: any) => Promise<WebWindow>

Description

Updates the context object of the window

Parameters

Name Type Required Description
context any

The new context object for the window.

RelativeDirectionenumeration

Description

  • "top"
  • "left"
  • "right"
  • "bottom"

  • Home
  • Privacy policy
  • Contact Us
  • interop.io
  • Overview
  • API
  • Bounds
  • Settings
  • WebWindow
  • RelativeDirection
Navigate
Go