Skip to content

Node.js API

johnjbarton edited this page Jan 29, 2015 · 2 revisions

Standard-ish API

The Loader standard came and went. Our implementation remains:

var System = require('./src/node/System.js');
System.import('./test_module.js', {}).then(function(mod) {
      assert.equal('test', mod.name);
      assert.equal('A', mod.a);
      assert.equal('B', mod.b);
      assert.equal('C', mod.c);
      done();
    }).catch(done);

Unstable NodeJS API

The NodeJS API for compiling is the following:

var api = require('traceur/src/node/api.js');
var result = api.compile('let a = 1;', {blockBinding: true});