naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

How to use NW.js API? #1

Closed ales-tsurko closed 7 years ago

ales-tsurko commented 7 years ago

Hi! Sorry for a dumb question, but how do you use NW.js API (or capture the browser's context)? I'm trying to open a popup with nw.Window.open() in the index.js, but getting 'nw' is not defined.

naviapis commented 7 years ago

get nw object from window object.

const nw = window.nw;
nw.Window.open('https://github.com');

or

changed to global object. update nw-react-scripts@^0.2.3.

nw.Window.open('https://github.com'); // direct

thanks.

ales-tsurko commented 7 years ago

Thanks!