The App API – the core of your applications
Eventually, we can dive deep into the actual code behind NW.js applications. The app API provides a useful set of functionalities, which you can leverage to access main information and events of your application. We shall start describing, one by one, all the functionalities provided.
Opening a file in your application natively
There are many ways to open files in an NW.js application; in this section, we're going to deal with the opening of binded file types. Let's say you're developing a text editor; you'd probably want .txt
files to be associated with it.
Actually, the real binding is made on the packaging step described in Chapter 6, Packaging Your Application for Distribution, but to open a file using the OS functionality (for example, through the Open with contextual menu), we need to first be able to read the arguments passed when the application gets started.
As a matter of fact, when you choose to open a given...