jeudi 18 avril 2019

How to get source code location from ES6 JavaScript class instance?

I would like to generate some code from my object tree. In order to generate the required import statements, I need to find out the source code location for a given class from a class instance.

I am already able to get the expected name MyClass with

var name = instance.constructor.name;

but not the source code location

'/src/package/myClass.js'

=>How to do so?

For Java it would work like described here:

Find where java class is loaded from





Aucun commentaire:

Enregistrer un commentaire