March 26, 2023

Blog @ Munaf Sheikh

Latest news from tech-feeds around the world.

Release Neutralinojs v4.0.0 released! · neutralinojs/neutralinojs · GitHub

Release Neutralinojs v4.0.0 released! · neutralinojs/neutralinojs · GitHub

Milestone v4.0.0 was closed with 31 issues.

What’s new

API: os.execCommand

  • Renamed shouldRunInBackground option to background.
  • Supports stdIn as an optional input.
  • Returns multiple values: stdOut, stdErr, pid, and exitCode.

Core: API extensions

  • Config file supports new extensions array globally or in a specific mode.
  • Neutralino spawns extension processes based on extensions array.
  • Neutralino doesn’t send kill signals to extension processes. The extension developer needs to stop
    processes properly.
  • extension setting has 4 fields: id, command, commandLinux,commandDarwin, and commandWindows.
  • The command‘s (platform-specific command’s) value accepts ${NL_PATH} global variable.
  • Each extension process instance is called with three CLI args: --nl-port={}, --nl-extension-id={} and --nl-token={}
  • Enable/disable extensions with enableExtensions config.

Core: Static server

  • Supports setting document root (with documentRoot) via config. Now, it’s possible to launch the app without a subdirectory in the URL.

Core: Community driver processes

Now developers can use Neutralinojs as a part of their software with any programming language by spawning Neutralinojs as a child process.
Use exportAuthInfo to write auth details to ${NL_PATH}/.tmp/auth_info.json. Then the parent process can pick up access details there. Note that WebSocket communication needs to be initiated via extensions API/loader.

API: app.broadcast

  • Sends an event to all app clients. This method is for extension developers.

API: events.broadcast

  • Sends an event to all clients (apps and extensions). Useful for notifying important general events.

API: extensions

  • dispatch: Sends an event to a specific extension.
  • broadcast: Sends an event to all connected extensions. Useful for sending shutdown signals.
  • getStats: Returns details about loaded extensions and connected extensions.

API: updater

  • checkForUpdates: Send a request to a seed URL (JSON) and fetch update details.
  • install: Install updates based on the currently downloaded manifest.


  • appClientConnect and appClientDisconnect: Occurs when a new app instance is launched and closed respectively.
  • extClientConnect and extClientDisconnect: Occurs when a new extension is connected and disconnected respectively.
  • extensionReady can be used to implement immediate extension calls. This is implemented from the client-side with extensions.getStats and extClientConnect. This event gurantees that it will be triggered regardless of the extension’s start time.

Error codes

  • NE_EX_EXTNOTC: Thrown by extensions.dispatch if the target extension is not connected.
  • NE_UP_CUPDMER: Thrown by updater.checkForUpdates if the JSON update manifest is invalid or applicationId is not matching.
  • NE_UP_CUPDERR: Thrown by updater.checkForUpdates if the updater API cannot fetch the manifest.
  • NE_UP_UPDNOUF: Thrown by updater.install when the update manifest is not loaded.
  • NE_UP_UPDINER: Thrown by updater.install for update installation errors.

Bug fixes

  • Fix port 0 issue with modes. Earlier, if the developer sets port as 0 from a specific mode,
    the NL_PORT also becomes 0.
  • Fix an issue with writeToLogFile config option. Earlier, the log file was created even this
    option is set to false.

Global variables

  • NL_APPVERSION: Value of the version key in the config file.

Get started:

Source link