io.workspaces.layoutsWorkspaceLayoutsAPIinterface
An API enabling basic CRUD workspaces actions
7 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. |
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()⚓︎
(config: WorkspaceLayoutSaveConfig) => Promise<WorkspaceLayout>
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. |