• Complain

Dmitry Sheiko [Dmitry Sheiko] - Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React

Here you can read online Dmitry Sheiko [Dmitry Sheiko] - Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: Packt Publishing Ltd, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Dmitry Sheiko [Dmitry Sheiko] Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React
  • Book:
    Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React
  • Author:
  • Publisher:
    Packt Publishing Ltd
  • Genre:
  • Year:
    2017
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Build powerful cross-platform desktop applications with web technologies such as Node, NW.JS, Electron, and ReactAbout This BookBuild different cross-platform HTML5 desktop applications right from planning, designing, and deployment to enhancement, testing, and deliveryForget 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 TypeScriptWho This Book Is ForThis 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 LearnPlan, design, and develop different cross-platform desktop appsApplication architecture with React and local stateApplication architecture with React and Redux storeCode design with TypeScript interfaces and specialized typesCSS and component libraries such as Photonkit, Material UI, and React MDLHTML5 APIs such as desktop notifications, WebSockets, WebRTC, and othersDesktop environment integration APIs of NW.js and ElectronPackage and distribute for NW.JS and ElectronIn DetailBuilding and maintaining cross-platform desktop applications with native languages isnt a trivial task. Since its 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 approachFilled with real world examples, this book teaches you to build cross-platform desktop apps right from scratch using a step-by-step approach.

Dmitry Sheiko [Dmitry Sheiko]: author's other books


Who wrote Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React? Find out the surname, the name of the author of the book and a list of all author's works by series.

Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Creating a File Explorer with NW.js Enhancement and Delivery

Well, we have a working version of File Explorer that can be used to navigate the filesystem and open files with the default associated program. Now we will extend it for additional file operations, such as deleting and copy pasting. These options will keep in a dynamically built context menu. We will also consider the capabilities of NW.js to transfer data between diverse applications using the system clipboard. We will make the application respond to command-line options. We will also provide support for multiple languages and locales. We will protect the sources by compiling them into native code. We will consider packaging and distribution. At the end, we will set up a simple release server and make the File Explorer auto-update.

Deployment and updates

Built-in capacities for auto updates is one of Electron's most prominent advantages over NW.js. Electron's autoUpdater module ( http://bit.ly/1KKdNQs ) utilizes the Squirrel framework ( https://github.com/Squirrel ), which makes silent possible. It works nicely in conjunction with the existing solution for multiplatform release servers; in particular, one can run it with Nuts ( https://github.com/GitbookIO/nuts ) using GitHub as a backend. We can also quickly set up a fully-featured node server based on electron-release-server ( https://github.com/ArekSredzki/electron-release-server ), which includes release management UI.

Electron-updater doesn't support Linux. The project maintainers recommend using the distribution's package manager to update the application.

For the sake of brevity, we will walk through a simplified autoupdate approach that doesn't require a real release server, but only requires access to static releases via HTTP.

We start by installing the package:

npm i -S electron-updater

Now, we add to the manifest's build field--publish property:

"build": {
"appId": "com.example.chat",
"publish": [
{
"provider": "generic",
"url": "http://127.0.0.1:8080/"
}
]
},
...

Here, we state that our dist folder will be available publicly on 127.0.0.1:8080, and we go on with the generic provider. Alternatively, the provider can be set to Bintray ( https://bintray.com/ ) or GitHub.

We modify our main process script to take advantage of the electron-updater API--./app/main.js:

const { app, BrowserWindow, ipcMain } = require( "electron" ),
{ autoUpdater } = require( "electron-updater" );
function send( event, text = "" ) {
mainWindow && mainWindow.webContents.send( event, text );
}
autoUpdater.on("checking-for-update", () => {
send( "info", "Checking for update..." );
});
autoUpdater.on("update-available", () => {
send( "info", "Update not available" );
});
autoUpdater.on("update-not-available", () => {
send( "info", "Update not available" );
});
autoUpdater.on("error", () => {
send( "info", "Error in auto-updater" );
});
autoUpdater.on("download-progress", () => {
send( "info", "Download in progress..." );
});
autoUpdater.on("update-downloaded", () => {
send( "info", "Update downloaded" );
send( "update-downloaded" );
});
ipcMain.on( "restart", () => {
autoUpdater.quitAndInstall();
});

Basically, we subscribe for the autoUpdater events and report them to the renderer script using the send function. When update-downloaded is fired, we send the update- downloaded event to the renderer. The renderer on this event supposedly reports to the user about a newly downloaded version and asks whether it would be convenient to restart the application. When confirmed, the renderer sends the restart event. From the main process, we subscribe to it using ipcMain ( http://bit.ly/2pChUNg ). So, when reset is fired, autoUpdater restarts the application.

Note that electron-debug won't be available after packaging, so we have to remove it from the main process:

// require( "electron-debug" )();

Now, we make a few changes to the renderer script--./app/index.html:


Chat

require( "./build/renderer.js" );

// Listen for messages
const { ipcRenderer } = require( "electron" ),
statusbar = document.getElementById( "statusbar" );

ipcRenderer.on( "info", ( ev, text ) => {
statusbar.innerHTML = text;
});
ipcRenderer.on( "update-downloaded", () => {
const ok = confirm('The application will automatically restart to finish installing the update');
ok && ipcRenderer.send( "restart" );
});


In HTML, we add the element with ID statusbar, which will print out reports from the main process. In JavaScript, we subscribe for main process events using ipcRenderer ( http://bit.ly/2p9xuwt ). On the info event, we change the content of the statusbar element with the event payload string. When update-downloaded occurs, we call confirm for the user opinion about a suggested restart. If the result is positive, we send the restart event to the main process.

Eventually, we edit CSS to stick our statusbar element in the left-bottom corner of the viewport--./app/assets/css/custom.css:

.statusbar {
position: absolute;
bottom: 1px;
left: 6px;
}

Everything is done; let's rock it! So, we first rebuild the project and release it:

npm run build
npm run dist

We make the release available through HTTP using http-server ( https://www.npmjs.com/package/http- server ):

http-server ./dist

We run the release to install the application. The application starts up as usual because no new releases are available yet, so we release a new version:

npm version patch
npm run build
npm run dist
In the footer component, we display the application name and version taken by the require function from the manifest. Webpack retrieves it at compilation time. So, if package.json is modified after the application is built, the changes do not reflect in the footer; we need to rebuild the project.
Alternatively, we can take the name and version dynamically from the app ( http://bit.ly/2qDmdXj ) object of Electron and forward it as an IPC event to the renderer.

Now, we will start our previously installed release and this time, we will observe the autoUpdater reports in statusbar. As the new release is downloaded, we will get the following confirmation window:

After pressing OK the application closes and a new window showing the - photo 1

After pressing OK , the application closes and a new window showing the installation process pops up:

When its done start the updated application Note that the footer now - photo 2

When it's done, start the updated application. Note that the footer now contains the latest released version:

Utilizing WebSockets We have a static prototype and now we will make it - photo 3
Utilizing WebSockets

We have a static prototype, and now we will make it functional. Any chat requires communication between connected clients. Usually, clients do not connect directly but through a server. The server registers connections and forwards the messages. It's pretty clear how to send a message from the client to server, but can we do it in the opposite direction? In the olden days, we had to deal with long-polling techniques. That worked, but with the overhead of HTTP, it is not really suitable when we mean a low latency application. Luckily for us, Electron supports WebSockets. With that API, we can open a full-duplex, bi-directional TCP connection between the client and server. WebSockets provides higher speed and efficiency as compared to HTTP. The technology brings reduction of upto 500:1 in unnecessary HTTP traffic and 3:1 in latency ( http://bit.ly/2ptVzlk ). You can find out more about WebSockets in my book

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React»

Look at similar books to Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React»

Discussion, reviews of the book Cross-Platform Desktop Application Development: Electron, Node, NW.js, and React and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.