Why we built Neutralinojs framework ? — Part I
Note : This article is bit outdated due to major updates of our work. But this explains key idea.
Let’s begin with cross platform applications. Developers were creating cross platform applications by writing separate code bases or they used cross platform GUI tool kit to do their work easier inside single code base.
Thereafter, Chromium based frameworks came to play the game. As we know Electronjs and Nw.js (aka node webkit) are very popular open source frameworks that allow developers to create cross platform applications using web technologies (Javascript, HTML and CSS)
Electronjs and its unseen drawbacks
Idea behind electron is awesome. They have packaged Chromium and nodejs together. Chromium handles the DOM rendering process and in the other hand Nodejs handles native os functions. Electronjs generates heavy output since the final output contains the Node run-time and chromium embedded browser also. Further the initial development with electronjs will take more time since hundreds of dependency libraries will be installed and Nodejs is required too.
Intermission
So how if we are able to replace chromium source with the default web browser and if we are able to make a lightweight server run-time instead of Node run-time. Awesome right! 😋 it gives us kind of different feeling 🤫..
Neutralinojs
We built lightweight server run-times for Windows and Linux using C++ with the help of socket programming approach and compressed Javascript library for communicating with server. Therefore you will be able to mix the native os functions in web apps. Thus Neutralinojs has single portable SDK(less than ~1MB) for Windows and Linux . SDK has neutralino binaries that will open user’s default web browser immediately in order run desired app
Shutdown computer with click event of html button? 😱 Yes why not 💪 💪
Developing Neutralino apps
let getUsername = () => {
let key = NL_OS == 'Windows' ? 'USERNAME' : 'USER';
Neutralino.os.getEnvar(key, (data) => {
document.getElementById('name').innerText = data.value;
},
() => {
//handle error
}
);
}Neutralino.init({
load: () => {
getUsername();
},
pingSuccessCallback : () => {
},
pingFailCallback : () => {
}
});
Above code snippet will display logged user’s name in text field which has id as name
. The Neutralino.os.getEnvar()
function can be used to fetch an environment variable
Getting started
Neutralinojs is at experimental stage right now. it needs couple of improvements further. But we did several pre-releases that can be found here and also the API documentation (with a sample Neutralino app source) is available at here
Several features of current version,
- os, filesystem, computer modules with useful functions
- Global variables
- Token based authentication
- Automatic run-time shutdown
Take a look on change log
Contribution
Neutralinojs is an open source framework, your contribution is highly appreciated! 😍
Support me on Patreon
Stay tuned for next episode.. happy coding 👋