interface-iboardwidgetscommands
Interface: IBoardWidgetsCommands
Commands related to widgets such creation, modification and metadata.
Hierarchy
- IBoardWidgetsCommands
Index
Methods
- __blinkWidget
- __getIntersectedObjects
- areAllWidgetsLoaded
- bringForward
- create
- deleteById
- get
- sendBackward
- transformDelta
- update
Methods
__blinkWidget
▸ __blinkWidget(widgets
: InputWidgets): Promise<void>
Makes a widget perform a "blink" animation in the board.
experimental
Parameters:
Name | Type |
---|---|
widgets | InputWidgets |
Returns: Promise<void>
A promise resolving if the widget was found.
__getIntersectedObjects
▸ __getIntersectedObjects(pointOrRect
: IPoint | IRect): Promise<IWidget[]>
Finds all widgets intersected in a specific area.
Requires scope: BOARDS:READ
experimental
Parameters:
Returns: Promise<IWidget[]>
A Promise resolving with the widgets found in the requested area.
areAllWidgetsLoaded
▸ areAllWidgetsLoaded(): Promise<boolean>
Checks if all widgets on the board had been loaded.
Returns: Promise<boolean>
A promise resolving after all the widgets in the board had been loaded.
bringForward
▸ bringForward(widgetId
: InputWidgets): Promise<void>
Brings a widget forward in the board (above other widgets)
Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user
Parameters:
Name | Type |
---|---|
widgetId | InputWidgets |
Returns: Promise<void>
A promise resolving after the widget was brought forward.
create
▸ create<T>(widgets
: OneOrMany<WidgetToBeCreated>): Promise<T[]>
Creates a widget in the board.
A type
is required.
See IWidget for more information about the different type of widgets and their properties.
Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for the current user
Example
miro.board.widgets.create({type: "sticker", text: "Hello world"})
Type parameters:
Name | Type |
---|---|
T | IWidget |
Parameters:
Name | Type |
---|---|
widgets | OneOrMany<WidgetToBeCreated> |
Returns: Promise<T[]>
A promise resolving into an array containing the newly created widgets.
deleteById
▸ deleteById(widgetIds
: InputWidgets): Promise<void>
Deletes a single widget from the board
Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user
Parameters:
Name | Type | Description |
---|---|---|
widgetIds | InputWidgets | Widget to be deleted |
Returns: Promise<void>
A promise resolving after the widget was deleted.
get
▸ get<T>(filterBy?
: Record<string, unknown>): Promise<T[]>
Get all the board widgets matching a filter filterBy
.
filterBy uses https://lodash.com/docs/4.17.11#filter
See IWidget for more information about the different type of widgets and their properties.
Requires scope: BOARDS:READ
Example
const stickers = miro.board.widgets.get({type: "sticker"})
Type parameters:
Name | Type |
---|---|
T | IWidget |
Parameters:
Name | Type |
---|---|
filterBy? | Record<string, unknown> |
Returns: Promise<T[]>
A promise resolving into an array of widgets matching the filter
sendBackward
▸ sendBackward(widgetId
: InputWidgets): Promise<void>
Send a widget to the back (below other widgets).
Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user
Parameters:
Name | Type |
---|---|
widgetId | InputWidgets |
Returns: Promise<void>
A promise resolving after the widget was sent forward.
transformDelta
▸ transformDelta(widgetIds
: InputWidgets, deltaX?
: undefined | number, deltaY?
: undefined | number, deltaRotation?
: undefined | number): Promise<IWidget[]>
Modifies the widgets position and rotation based on the passed parameters.
Parameters:
Name | Type | Description |
---|---|---|
widgetIds | InputWidgets | - |
deltaX? | undefined | number | Translation on the X axis. |
deltaY? | undefined | number | Translation on the Y axis |
deltaRotation? | undefined | number | Rotation of the widget Requires scope: BOARDS:WRITE Requires BoardPermission.EDIT_CONTENT for current user |
Returns: Promise<IWidget[]>
A promise resolving into an array with the modified widgets.
update
▸ update<T>(widgets
: OneOrMany<{ [index:string]: any; id: string }>): Promise<T[]>
Modify one or many widgets in the board.
An id
is mandatory.
See IWidget for more information about the different type of widgets and their properties.
Requires scope: BOARDS:WRITE
Requires BoardPermission.EDIT_CONTENT for current user
Type parameters:
Name | Type |
---|---|
T | IWidget |
Parameters:
Name | Type |
---|---|
widgets | OneOrMany<{ [index:string]: any; id: string }> |
Returns: Promise<T[]>
A promise resolving into an array with the modified widgets.
Updated almost 2 years ago