camo icon indicating copy to clipboard operation
camo copied to clipboard

Possible to use Camo with a non-ES6 codebase?

Open JamesMGreene opened this issue 9 years ago • 2 comments

Is there any easy way to use Camo with a non-ES6 codebase (Node.js standard CommonJS-style modules)? I would love to use it but I cannot switch our codebase over to ES6 modules as of yet (nor can I move to Node.js >= 2.x as of yet).

JamesMGreene avatar Jan 11 '16 06:01 JamesMGreene

Hi James,

As of right now the only way you could use Camo with a non-ES6 codebase is if you used Babel (or some other transpiler), and even then there are some issues. Due to issue #17, I'm considering converting all internal Camo classes to be prototype-based, but I first need to see if prototype-based classes are compatible with ES6 classes - I have never mixed the two.

Hopefully I can get back to you on this within the week. Suggestions and feedback are welcome!

Thanks!

scottwrobinson avatar Jan 18 '16 22:01 scottwrobinson

@scottwrobinson ES6 classes are compatible with prototyping. At the moment I am experimenting with a code architecture based on C++ classes. I am using this architecture at work and I also use it for one of my FOSS projects (and will restructure the others later on). You can find a detailed explanation here and the FOSS project here. As you can see in the readme, the interface uses an ES6 class, but in the code-files I overwrite the class' methods with prototype functions, nicely splitting the interface and the actual code. ES6 classes are nothing more than syntactical sugar after all :)

minecrawler avatar Feb 08 '16 17:02 minecrawler