0

I am trying to set up a small node script to play with zone.js. But I am confused about how to require this library into node script.

My script goes as following:

var Zone = require('zone.js/dist/zone-node.js');

console.log('test...', Zone)

function main() {
    foo();
    setTimeout(doSomething, 2000);
    bar();
    baz();
}

function doSomething() {
    console.log('Async task');
}  

function foo() {
    console.log('foo')
}
function bar() {
    console.log('bar')
}
function baz() {
    console.log('baz')
}

// Zone.run(main)

The imported Zone is an empty object. And what's the correct way to do it?

Chris Bao
  • 2,418
  • 8
  • 35
  • 62

1 Answers1

0

Here is the example repo. https://github.com/JiaLiPassion/zone-node the Zone is not an exported object, it is registered to global.

jiali passion
  • 1,691
  • 1
  • 14
  • 19