The-M-Project 2: Is it possible to get the M.View from the DOM Object?

108 views Asked by At

With version 1.x of The-M-Project it was possible to get a View by its ID from the ViewManager. So it was easy to use this as debug tool in the developer console. As I've seen so far with Version 2 the views don't have IDs anymore. How can I have access to them, especially for debugging purposes?

1

There are 1 answers

0
hano On

In version 2.0 theres still a M.ViewManager. I think what you are looking for is the M.ViewManager.getView method. As parameter add the root-DOM node of a M.View. In the Chrome dev tools you get the selected DOM-Node with $0. From the docs: http://www.the-m-project.org/docs/absinthe/ViewManager.html

M.ViewManager.getView($0);
M.ViewManager.getView($0)._type //M.View