Collect shape coordinates drawn by user in js

Hi !

I have a plot in js and I am looking for a way to let user draw a free shape one the plot (with lasso select or drawopenpath option) and collect coordinates of the shape.
I have seen that this is possible using Dash and callbacks but I cannot find a way to do it in js.

From the following example I am able to collect selected points with lasse but not actual coordinates of the shape. Lasso Selection | JavaScript | Plotly

Any suggestions ?

Thanks a lot
Ouriel