mercredi 11 mars 2015

Identify when single page app is running as a nw.js app


Vote count:

0




How can I identify if your single page web app is running with nw.js (previously known as nodewebkit) via javascript? I'd like to be able to share the code between the web client and the nw.js app, while being able to figure when to use different code based on the running implementation.


I'm not sure if determining this while the app is running, is the best approach, as I should probably have an entirely different build task for the tool, but this seems like the path of least resistance at the moment, as I'm unfamiliar with most of ember-cli's features (my current build tool).



asked 44 secs ago

ABot

177

1 Answer



Vote count:

0




This works for me



window.IS_NW = typeof window.process !== 'undefined'


However this will be a false positive if there is already a defined global named process.



answered 44 secs ago

ABot

177





Identify when single page app is running as a nw.js app

Aucun commentaire:

Enregistrer un commentaire