You have to remember that once you are in JS, you are only really able to retrieve markup or representations of the DOM. The markup is the result of a combination of components, which is technically a "server only" concept. Components are just a way for CQ to organize executable code, so once a page is rendered a component isn't really a thing. The closest thing I can think of is to list all of the DIVs that represent a component wrapper that are on the page, but this is error prone and clunky. You could also make AJAX calls back to the server to retrieve a list of the components by node name, but that approach would not return synthetic resources (ones that render, but do not have a node representing them).
Why are you trying to do this? Maybe someone has a better idea, but this has a bad smell to me.
I dont know what your use case is - but if you append the querystring '?debug=layout' to the url of the page you are looking at, you can at least get a view of the resources included in the web browser.
What's the intended use?