0

In ES6, I want to use this sample code in angular 1.6 code.

var win = nw.Window.get();

win.on('new-win-policy', function(frame, url, policy){
    policy.forceNewWindow();
});

These are the steps I did,(updated package.json)

npm install nwjs

in code,

import nw from 'nwjs'; //I guess this is not correct

please help what am I doing wrong.

user17
  • 23
  • 5
  • Are there any errors? Also note that node doesn't support `import` by default so you need to either transpile it, replace it with `require` or run node with `--experimental-modules` – apokryfos Nov 15 '17 at 19:15
  • Error on fetch for nwjs.js at file:///Users/[Project_Dir]/nwjs.js, I am using gulp task to transpile. – user17 Nov 15 '17 at 19:31

2 Answers2

0

did you try ?

import nw = require('nwjs');

not sure if this works in angular project but this is how i use it in Node + Typescript.

Perry G
  • 91
  • 11
0

This works for me:

import {} from 'nw.js';