Build a desktop calculator app with Axino and Electron in one minute.
Here is the recipe:
Step 1 Download the tools:
Tool 1: npm
Npm is required to install Axino, Typescript and Parcel:
npm is installed as explained on the npm homepage: https://www.npmjs.com/get-npm
Be sure to download the version of npm which is compatible with your platform: Mac, Windows or Linux.
Tool 2: Typescript
Once npm is installed on your system, all the other tools can be installed via npm:
Typescript is installed by entering the following npm command in a terminal:
npm install -g typescript
Tool 3: Parcel
Parcel is installed in the same way by entering:
npm install -g parcel-bundler
Step 2 Create a directory for your app:
mkdir myapp (Linux and Mac)
or use your favorite “file manager” to create a dedicated directory.
Step 3 : initialize your app:
In the directory in question, run the command:
npm init -y
npm i Axino
in order to have a local “node_modules” directory installed by npm (which in turn will contain the Axino directory) , like this:
Step 4 : Go to the Axino examples subdirectory:
Step 5: Initialize the calculator example:
In axino/examples-electron-calculator/ run the command:
npm run build
npm run start
That’s it, you should now see your app:
NB: This app uses the function: evaluate(), which is a quick and dirty method to evaluate an algebraic expression. This is just a hack to emulate the functioning of a calculator. Since this evaluate() function is not deemed secure, a warning is displayed on the debugging tab on the right-hand part of the app. This debugging pane can be closed. When it is closed the app looks like the one displayed in the header of this article.
The code of the app is contained in the file: