Electron is a framework for creating native applications using web technologies like JavaScript, HTML, and CSS. More info here.
Update the system package manager and install some required dependencies and packages:
opkg updateopkg install libxss1 libcups2 nodejs nodejs-npm git
Execute the command “npm init” inside a folder called “electron” to create the package.json file. That will be the repository for the following install. Keep pressing “enter” so "npm init" keeps the default configuration:
mkdir electroncd electronnpm initname: (electron)version: (1.0.0)description:entry point: (index.js)test command:git repository:keywords:author:license: (ISC)About to write to /home/root/electron/package.json:{"name": "electron","version": "1.0.0","description": "","main": "index.js","scripts": {"test": "echo \"Error: no test specified\" && exit 1"},"author": "","license": "ISC"}
Install the pre-built Electron package:
npm install electron-prebuilt
With BSP 2.8 libxss1 is not part of the Angström feeds anymore. You have to compile the library manually with OpenEmbedded. Check the following article on how to setup the OpenEmbedded build system for your module: OpenEmbedded (core)
You don't have to build the whole BSP but only the missing libxscrnsaver:
bitbake libxscrnsaver
After compiling libxscrnsaver, you copy the file ../deploy/ipk/armv7at2hf-neon/libxss1_1.2.2-r0_armv7at2hf-neon.ipk to your module (For example, through SCP)
Now you need to install the general dependencies and libraries needed for Electron:
opkg updateopkg install libcups2 nodejs nodejs-npm git nss
Install libxss1 built with OpenEmbedded:
opkg install libxss1_1.2.2-r0_armv7at2hf-neon.ipk
To install Electron you can use a prebuilt version 3.x.x:
wget https://github.com/electron/electron/releases/download/v3.1.7/electron-v3.1.7-linux-armv7l.zipmkdir electroncd electronunzip ../electron-v3.1.7-linux-armv7l.zipchmod 755 electron
Note: Newer versions of Electron don't work because of an incompatible glibc version
Clone the repository of samples inside a folder:
mkdir Samplescd Samplesgit clone https://github.com/hokein/electron-sample-apps.git
To execute a sample, enter a specific sample directory and execute the command, for instance:
cd electron-sample-appscd frameless-window
BSP 2.7:
~/electron/node_modules/.bin/electron .
BSP 2.8:
~/electron/electron .
The videos below present some demos created in Electron: