Cross-platform Desktop Application Development: Electron, Node, NW.js, and React

Book description

Build powerful cross-platform desktop applications with web technologies such as Node, NW.JS, Electron, and React

About This Book

  • Build different cross-platform HTML5 desktop applications right from planning, designing, and deployment to enhancement, testing, and delivery
  • Forget the pain of cross-platform compatibility and build efficient apps that can be easily deployed on different platforms.
  • Build simple to advanced HTML5 desktop apps, by integrating them with other popular frameworks and libraries such as Electron, Node.JS, Nw.js, React, Redux, and TypeScript

Who This Book Is For

This book has been written for developers interested in creating desktop applications with HTML5. The first part requires essential web-master skills (HTML, CSS, and JavaScript). The second demands minimal experience with React. And finally for the third it would be helpful to have a basic knowledge of React, Redux, and TypeScript.

What You Will Learn

  • Plan, design, and develop different cross-platform desktop apps
  • Application architecture with React and local state
  • Application architecture with React and Redux store
  • Code design with TypeScript interfaces and specialized types
  • CSS and component libraries such as Photonkit, Material UI, and React MDL
  • HTML5 APIs such as desktop notifications, WebSockets, WebRTC, and others
  • Desktop environment integration APIs of NW.js and Electron
  • Package and distribute for NW.JS and Electron

In Detail

Building and maintaining cross-platform desktop applications with native languages isn't a trivial task. Since it's hard to simulate on a foreign platform, packaging and distribution can be quite platform-specific and testing cross-platform apps is pretty complicated.In such scenarios, web technologies such as HTML5 and JavaScript can be your lifesaver. HTML5 desktop applications can be distributed across different platforms (Window, MacOS, and Linux) without any modifications to the code.

The book starts with a walk-through on building a simple file explorer from scratch powered by NW.JS. So you will practice the most exciting features of bleeding edge CSS and JavaScript. In addition you will learn to use the desktop environment integration API, source code protection, packaging, and auto-updating with NW.JS.

As the second application you will build a chat-system example implemented with Electron and React. While developing the chat app, you will get Photonkit. Next, you will create a screen capturer with NW.JS, React, and Redux.

Finally, you will examine an RSS-reader built with TypeScript, React, Redux, and Electron. Generic UI components will be reused from the React MDL library. By the end of the book, you will have built four desktop apps. You will have covered everything from planning, designing, and development to the enhancement, testing, and delivery of these apps.

Style and approach

Filled with real world examples, this book teaches you to build cross-platform desktop apps right from scratch using a step-by-step approach.

Table of contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Creating a File Explorer with NW.js-Planning, Designing, and Development
    1. The application blueprint
    2. Setting up an NW.js project
    3. Node Package Manager
    4. An HTML prototype
      1. Maintainable CSS
      2. Defining base rules
      3. Defining layouts
      4. Defining CSS variables
      5. Sticking the title bar and header
      6. Styling the title bar
      7. Styling the directory list
      8. Styling a file list
      9. Styling the footer
    5. Fulfilling the functional requirements
      1. Starting with ES2015
      2. Scoping
      3. Classes
      4. The template literal
      5. Getters and setters
      6. Arrow functions
      7. Destructuring
    6. Handling windowing actions
    7. Writing a service to navigate through directories
      1. Unit-testing a service
    8. Writing view modules
      1. The DirList module
      2. Unit-testing a view module
      3. The FileList module
      4. The title bar path module
    9. Summary
  3. Creating a File Explorer with NW.js – Enhancement and Delivery
    1. Internationalization and localization
      1. Date format by country
      2. Multilingual support
    2. Context menu
    3. System clipboard
      1. Transferring text
      2. Transferring graphics
      3. Receiving text and graphics
    4. Menu in the system tray
    5. Command-line options
    6. Native look and feel
    7. Source code protection
    8. Packaging
    9. Autoupdate
    10. Summary
  4. Creating a Chat System with Electron and React – Planning, Designing, and Development
    1. Application blueprint
    2. Electron
    3. React
    4. Electron meets React
    5. Enabling DevTools extensions
    6. Static prototype
    7. Summary
  5. Creating a Chat System with Electron and React – Enhancement, Testing, and Delivery
    1. Revitalizing the title bar
    2. Utilizing WebSockets
    3. Implementing chat services
    4. Bringing functionality to the components
    5. Writing unit-tests
    6. Packaging and distribution
    7. Deployment and updates
    8. Summary
  6. Creating a Screen Capturer with NW.js, React, and Redux – Planning, Design, and Development
    1. Application blueprint
    2. Setting up the development environment
    3. Static prototype
    4. Comprehending redux
    5. Introducing the application state
    6. Summary
  7. Creating a Screen Capturer with NW.js: Enhancement, Tooling, and Testing
    1. Tooling Redux
    2. Redux DevTools
    3. Unit-testing Redux
      1. Testing action creator
      2. Testing reducers
    4. Taking a screenshot
    5. Recording a screencast
    6. Taking advantage of the system tray
    7. Registering global keyboard shortcuts
    8. Summary
  8. Creating RSS Aggregator with Electron, TypeScript , React, and Redux: Planning, Design, and Development
    1. Application blueprint
    2. Welcome to TypeScript
    3. Setting up the development environment for TypeScript
      1. Basic types
      2. Array, plain objects, and indexable types
      3. Function type
      4. Class type
      5. Abstract classes
      6. Enum type
      7. Union and intersection types
      8. Generic type
      9. Global libraries
    4. Creating static prototype
      1. Setting up the development environment for the application
      2. React-MDL
      3. Creating the index.html
      4. Creating the container component
      5. Creating the TitleBar component
      6. Creating the Menu component
      7. Creating the feed component
      8. Adding custom styles with SASS
    5. Summary
  9. Creating RSS Aggregator with Electron, TypeScript, React, and Redux: Development
    1. Creating a service to fetch RSS
    2. Creating a service to manage feed menu
    3. Actions and Reducers
    4. Connecting to the store
    5. Consuming store from the components
    6. Creating router service
    7. Summary

Product information

  • Title: Cross-platform Desktop Application Development: Electron, Node, NW.js, and React
  • Author(s): Dmitry Sheiko
  • Release date: July 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781788295697