Add method to generate js from a class