Building a cross-platform desktop app with NW.js, React and Flux

  • Was recently looking for information on building desktop apps with Electron or NW.js. Found a few useful links regarding source code protection. In short: Documented method is v8 snapshots. They are compiled code, run slower and are not cross platform.

    * Using v8 snapshots - https://github.com/nwjs/nw.js/wiki/Protect-JavaScript-source...

    * Electron thread about source code protection - https://github.com/atom/electron/issues/3041

    The second link has a lot of comments with useful information. One of them mentions that v8 snapshot format is documented and also that the actual code is shipped with the snapshot for future optimizations. nw.js just removes the sourcecode from the snapshot.

    I'm curious if there is any reliable means of source code protection for Electron or NW.js apps.

  • Long time user/supporter of both NW and Electron, It's worth noting that Electron has surpassed NW in almost every way at this point. If you want to program against clean node-style API's then Electron is the one to choose.

  • I hope React Native will expand to desktop eventually, native controlled by javascript is the best of both worlds.

  • So, what's the resident memory usage? That was part of why e.g. Java and Flex weren't that well received, and browser-based solutions didn't fare that well either.

    Okay enough for something enterprise-y, but once your fancy new IRC/Slack/Twitter client takes up a gig of RAM...

  • I reallllly want someone to repackage how NW.js works to be able to ship just the app files, and have NW.js work like the JVM. Super tired of having 20 different instances of webkit

    Very full guide though, down to release.

  • The section about crossing the uncanny valley reminds me of this old rant about Microsoft Foundation Classes:

    https://www.relisoft.com/resource/libs.html

    The author likens MFC to a specialized Lego set for building a pirate ship, whereas the Win32 API is a general Lego set. I think the analogy is much stronger if one replaces MFC with web tech in a native wrapper, and Win32 with any OS native toolkit.

  • Really nice article, thorough and shows the pluses and minuses of this solution.

    I noticed that they discarded the C++ option due to being unfamiliar with the language, but there might be an alternative: Qt's QML is a declarative language that's designed for easily creating interactive UIs and I think it's a great fit for a custom UI like the one in the article. The interesting part - one can embed and include JavaScript in a QML file (http://doc.qt.io/qt-5/qtqml-index.html).

  • I'd much rather use Java, and SWT, which implements native widgets than ship a browser without toolbars. They can even leverage their JS code with Nashorn or Rhino.

  • I think the intended package method is to get the user to first install nw.js then just give them the app files.

    nw.js is backwards compatible, so if your app works now, it will probably work in future versions too!

    If you do not care about Windows 7 you could use cardova instead.

  • Didn't see much of the Flux stuff explained.