Skip to main content
Access via:io.workspaces.layouts

An API enabling basic CRUD workspaces actions

9 Methods

delete()⚓︎

(name: string) => Promise<void>

Deletes a previously saved layout. In io.Connect Browser delete will fail with an error in trying to delete a read-only layout, this is a layout defined in the io.layouts.json file.

Parameters (1)

Name Type Required Description
name⚓︎ string

The name of the layout to delete.

deleteById()⚓︎

(layoutId: string) => Promise<void>

Deletes a previously saved layout by its id.

Parameters (1)

Name Type Required Description
layoutId⚓︎ string

The id of the layout to delete.

export()⚓︎

(predicate?: (layout: WorkspaceLayout) => boolean) => Promise<WorkspaceLayout[]>

Returns all layouts which satisfy the predicate. This collection of all saved layouts includes the layouts structure. If no predicate is provided, it returns all saved layouts.

Parameters (1)

Name Type Required Description
predicate⚓︎ (layout: WorkspaceLayout) => boolean x

A filtering function (predicate) called for each saved layout.

getSummaries()⚓︎

() => Promise<WorkspaceLayoutSummary[]>

Returns a collection of summarized layouts data. This data contains all the standard data excluding the actual structure of the layout. This is helpful in cases where a simple query of existing layouts is needed without the complexity of transmitting the full layouts structure.

import()⚓︎

(layouts: WorkspaceLayout[], mode?: "replace" | "merge") => Promise<void>

Saves the provided layouts into io.Connect. In io.Connect Browser this will fail with an error if a provided layout's name matches a read-only layout.

Parameters (2)

Name Type Required Description
layouts⚓︎ WorkspaceLayout[]

A collection of layouts to add to IO Connet.

mode⚓︎ "replace" | "merge" x x

onRemoved()⚓︎

(callback: (layout: WorkspaceLayout) => void) => Promise<Unsubscribe>

Notifies when a layouts has been removed.

Parameters (1)

Name Type Required Description
callback⚓︎ (layout: WorkspaceLayout) => void

Callback function to handle the event. Receives the removed layout as a parameter.

onSaved()⚓︎

(callback: (layout: WorkspaceLayout) => void) => Promise<Unsubscribe>

Notifies when a layouts has been saved. This event is fired when a new layout has been saved and an existing layout has been updated.

Parameters (1)

Name Type Required Description
callback⚓︎ (layout: WorkspaceLayout) => void

Callback function to handle the event. Receives the saved layout as a parameter.

save()⚓︎

Saves an existing, open workspace as a layout.

Parameters (1)

Name Type Required Description
config⚓︎ WorkspaceLayoutSaveConfig

An object describing the name of the layout and the id of the workspace, whose structure will be saved.

saveById()⚓︎

Overwrites the layout with the specified id with the structure of an existing, open workspace. Prefer this over save() when layout names aren't guaranteed to be unique (e.g. when layout sharing is enabled).

Parameters (1)

Name Type Required Description
config⚓︎ WorkspaceLayoutSaveByIdConfig

An object describing the id of the layout to overwrite, the layout name and the id of the workspace, whose structure will be saved.