node package manager

electron-nucleus

electron-nucleus npm

Analytics, licensing and crash reports made simple for Electron using Nucleus.

To start using this module you need to sign up and get an app id on the Nucleus website.

This module is mainly working on the renderer process, but needs to be initiated in the main process for crash reports.

Installation

Using npm:

$ npm install electron-nucleus --save

Usage

In both renderer and main process add the following script:
If you don't add it to the main process, it won't be able to report crashes.

const Nucleus = require("electron-nucleus")("<Your App Id>")
 

You can sign up and get an ID for your app here.

Development Mode

If you want to track data during development, add true as the second argument of the init method.

const Nucleus = require("electron-nucleus")("<Your App Id>", true)

Note : when running in development, depending on your env setup and location of the electron module, the app name and version can vary.

Events

After initializing Nucleus, you can send your own custom events.

Nucleus.track("PLAYED_TRACK")

License checking

You can check if a license (created via Nucleus's API) is valid with the following code:

Nucleus.checkLicense('SOME_LICENSE', (err, license) => {
    if (err) return console.error(err)
 
    if (license.valid) {
        console.log('License is valid :) Using policy '+license.policy)
    } else {
        console.log('License is invalid :(')
    }
})

Custom metrics

Coming soon.


Contact hello@nucleus.sh for any inquiry