io.workspacesAPIinterface
Properties (2)
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| layouts⚓︎ | WorkspaceLayoutsAPI | x | An API which gives full read, write and delete access to the workspaces layouts. |
|
| version⚓︎ | string | x | The io.Connect Workspaces API version. |
30 Methods
createEmptyFrame()⚓︎
(definition?: EmptyFrameDefinition) => Promise<Frame>
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| definition⚓︎ | EmptyFrameDefinition | x | Optional definition of the frame |
createWorkspace()⚓︎
(definition: WorkspaceDefinition, saveConfig?: WorkspaceCreateConfig) => Promise<Workspace>
Opens a new workspace based on the provided definition.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
| definition⚓︎ | WorkspaceDefinition | An object describing the shape and options of the workspace. |
|
| saveConfig⚓︎ | WorkspaceCreateConfig | x | An object used to set various create options. |
getAllFrames()⚓︎
getAllWorkspaces()⚓︎
getAllWorkspacesSummaries()⚓︎
() => Promise<WorkspaceSummary[]>
Returns an collection of objects, where each object contains basic information about an open workspace. This function was designed for easy and quick listing of existing workspaces without adding the complexity of transmitting the entire structure of each workspace.
getBox()⚓︎
(predicate: (box: WorkspaceBox) => boolean) => Promise<WorkspaceBox>
Returns the instance of the first box, which satisfies the provided predicate. This function will search recursively in all open workspaces.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| predicate⚓︎ | (box: WorkspaceBox) => boolean | A filtering function (predicate) called for each box in each open workspace. |
getBuilder()⚓︎
(config: BuilderConfig) => WorkspaceBuilder | BoxBuilder
Gets either a workspace or a box builder depending on the provided type inside the config object. This builder is used to dynamically construct a workspace runtime.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| config⚓︎ | BuilderConfig | An object describing the type of the requested builder, alongside other settings. |
getFrame()⚓︎
getMyFrame()⚓︎
() => Promise<Frame>
Returns the frame instance of the calling window. Throws an error if the calling window is not part of a workspace.
getMyWorkspace()⚓︎
() => Promise<Workspace>
Returns the instance of the workspace where the calling window is located. Throws an error if the calling window is not not part of any workspace.
getWindow()⚓︎
(predicate: (workspaceWindow: WorkspaceWindow) => boolean) => Promise<WorkspaceWindow>
Returns the workspace window instance of the first window, which is part of a workspace and satisfies the provided predicate. This function will search recursively in all open workspaces.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| predicate⚓︎ | (workspaceWindow: WorkspaceWindow) => boolean | A filtering function (predicate) called for each window in each open workspace. |
getWorkspace()⚓︎
getWorkspaceById()⚓︎
(workspaceId: string) => Promise<Workspace>
Returns an instance of the workspace with the passed id. The performance is better than getWorkspace when querying for a workspace by id.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| workspaceId⚓︎ | string | The id of the desired workspace |
inWorkspace()⚓︎
() => Promise<boolean>
Checks whether or not the calling window is currently present inside of a workspace
onFrameClosed()⚓︎
(callback: (closed: FrameClosedData) => void) => Promise<Unsubscribe>
Notifies when a new frame was closed and returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (closed: FrameClosedData) => void | Callback function to handle the event. Receives an object containing the id of the closed frame as a parameter. |
onFrameOpened()⚓︎
(callback: (frame: Frame) => void) => Promise<Unsubscribe>
onWindowAdded()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when a new window was added to any workspace in any frame and returns an unsubscribe function. An added window means that the window has a place in a workspace (it is a valid workspace element), but does not guarantee that the contents of the window are loaded.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function to handle the event. Receives the added window as a parameter. |
onWindowLoaded()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when a window's content was loaded in any workspace in any frame and returns an unsubscribe function. A loaded window is a window, which was added to a workspace, it's contents were loaded and it is present in the windows collection.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function to handle the event. Receives the loaded window as a parameter. |
onWindowMaximized()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when a window was maximized in any workspace in any frame and returns an unsubscribe function. A maximized window means that the window has been maximized either by an API call or from the maximize button by the user.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function to handle the event. Receives the maximized window as a parameter. |
onWindowRemoved()⚓︎
(callback: (removed: { windowId?: string; workspaceId: string; frameId: string }) => void) => Promise<Unsubscribe>
Notifies when a window was removed from any workspace and any frame and returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (removed: { windowId?: string; workspaceId: string; frameId: string }) => void | Callback function to handle the event. Receives an object containing the ids of the removed window, and the respective workspace and frame as a parameter. |
onWindowRestored()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when a window was restored from a maximized state in any workspace in any frame and returns an unsubscribe function. A restored window means that the window has been restored from a maximized state either by an API call or from the restore button by the user.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function to handle the event. Receives the restored window as a parameter. |
onWindowSelected()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when a window was selected in any frame and returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function to handle the event. Receives the selected window as a parameter. |
onWindowTabReordered()⚓︎
(callback: (workspaceWindow: WorkspaceWindow) => void) => Promise<Unsubscribe>
Notifies when the tab of a Workspace window participating in any Workspace in any Workspaces App has been reordered. Returns an unsubscribe function.
io.Connect Browser 4.4Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspaceWindow: WorkspaceWindow) => void | Callback function for handling the event. Receives as an argument the |
onWorkspaceClosed()⚓︎
(callback: (closed: WorkspaceClosedData) => void) => Promise<Unsubscribe>
Notifies when a workspace present in any of the opened frames was closed and returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (closed: WorkspaceClosedData) => void | Callback function to handle the event. Receives an object with the closed workspace id and frame id as a parameter. |
onWorkspaceHibernated()⚓︎
(callback: (workspace: Workspace) => void) => Promise<Unsubscribe>
Notifies when a Workspace is hibernated. This event will be fired for any Workspace hibernated in any currently running instance of a Workspaces App. Returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspace: Workspace) => void | Callback function for handling the event. Receives as an argument the |
onWorkspaceOpened()⚓︎
(callback: (workspace: Workspace) => void) => Promise<Unsubscribe>
onWorkspaceResumed()⚓︎
(callback: (workspace: Workspace) => void) => Promise<Unsubscribe>
Notifies when a Workspace is resumed after being hibernated. This event will be fired for any Workspace resumed in any currently running instance of a Workspaces App. Returns an unsubscribe function.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspace: Workspace) => void | Callback function for handling the event. Receives as an argument the |
onWorkspaceTabReordered()⚓︎
(callback: (workspace: Workspace) => void) => Promise<Unsubscribe>
Notifies when the tab of any Workspace in any Workspaces App has been reordered. Returns an unsubscribe function.
io.Connect Browser 4.4Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (workspace: Workspace) => void | Callback function for handling the event. Receives as an argument the |
restoreWorkspace()⚓︎
(name: string, options?: RestoreWorkspaceConfig) => Promise<Workspace>
Opens a new workspace by restoring a previously saved workspace layout.
Parameters (2)
| Name | Type | Required | Description |
|---|---|---|---|
| name⚓︎ | string | The name of a saved workspace layout, which will be restored. |
|
| options⚓︎ | RestoreWorkspaceConfig | x | An optional object containing various workspace restore options. |
waitForFrame()⚓︎
(id: string) => Promise<Frame>
Wait for a frame with the specified id to be loaded. It's needed when using the workspaces-api from a custom workspaces frame and you have the frameId, but the frame object is not populated in the API yet (e.g. the frame is in the pool)
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| id⚓︎ | string | the id of the frame that should be waited |