Traceur

I’ve written aother node module to provide Google Traceur support for Node.JS

If you are not familiar with Traceur, read up on it here: http://code.google.com/p/traceur-compiler/
And the features it provides: http://code.google.com/p/traceur-compiler/wiki/LanguageFeatures

http://github.com/aikar/traceur

To use:
npm install traceur
then require(‘traceur’)

then all require() calls can be traceur syntax files.

Note you can’t use Traceur syntax on the file that includes Traceur,
since this extends require() itself to go through Traceur first before
being passed to normal node require().

 

 

Example:

foo.js has:

class Foo {
  new() {
    console.log("New Instance!");
  }
  bar() {
    console.log('Bar!');
  }
}

module.exports = Foo;

Then this script would echo “New Instance!” and “Bar!”

  
  require("traceur");
  var Foo = require('./foo.js');
  var instance = new Foo;
  instance.bar();

 

Note now, classes are created in Local Scope with Traceur, so you must export it

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 221 other subscribers

I am Senior Software Engineer and Entrepeneur. I am an enthusiast and love creating things. I operate my own side company in my free time called Starlis LLC, working in Minecraft.

I enjoy doing things right and learning modern technologies.