Answered

Detect when a miro board widgets gets created and deleted

  • 19 November 2020
  • 1 reply
  • 485 views

Userlevel 2
Badge +3

Is there a integrated miro command or any other way to detect when a miro widget gets created on a board? And even more importantly can we access it’s id and other data immediately as it gets created? The only solution to this that comes to my mind is to gather all current miro board widget id’s and compare them in certain time intervals against new widget id’s whenever the time interval triggers. This solution seems really dirty and inefficient to me though so I’m trying to ask here first to find out if I could theoretically implement some sort of a event listener for miro widget creation

icon

Best answer by Daniela Gavidia 19 November 2020, 18:44

View original

1 reply

Userlevel 4
Badge

Hello Sami,

 

You can add a listener for the WIDGETS_CREATED event. Like this:

miro.addListener('WIDGETS_CREATED', event => {
const widget = event.data[0];
console.log(widget);
})

Similarly, you can also listen to the WIDGETS_DELETED event. For more on events, please refer to:
https://developers.miro.com/docs/web-plugins-features#section-listen-to-events-on-the-board
https://developers.miro.com/docs/interface-event

I hope this helps.

 

Kind regards.

 

Daniela

Reply