npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electron-lisenser

v0.0.7

Published

An electronjs client for Lisenser service

Downloads

19

Readme

electron-lisenser

Electron/Javascript Client for the Lisenser Service

Installation

npm install electron-lisenser

Quick Start

import { Lisenser } from 'lisenser'

const lisenser = new Lisenser('<your-product-id>', 'My App')

async function checkLicense() {
  const status = await lisenser.getLicenseStatus()

  switch (status.status) {
    case 'no-key':
      console.log('No license key found')
      break
    case 'invalid':
      console.log('Invalid license key')
      break
    case 'expired':
      console.log(`License expired ${status.daysToExpiry} days ago`)
      break
    case 'active':
      console.log(`License will expire in ${status.daysToExpiry} days`)
      break
  }
}

checkLicense()

API Reference

Lisenser

An instance of the Lisenser class is used to manage the license status of an Electron app.

productId: string

The product ID of the app.

appName: string

The name of the app.

machineId: string

A unique identifier for the machine running the app.

constructor(productId: string, appName: string = '', machineId?: string)

Initializes a new instance of the Lisenser class.

Parameters
  • productId The product ID of the app.
  • appName The name of the app.
  • machineId A unique identifier for the machine running the app. If not provided, a machine ID will be generated using the machine-digest package.

getLicenseStatus(): Promise<client.LicenseStatus>

Returns the status of the license key. If no license key is stored locally, returns no-key.

Returns

The status of the license key.


activateLicenseKey(licenseKey: string): Promise<client.LicenseStatus>

Activates the given license key.

Parameters
  • licenseKey The license key to activate

Returns

The status of the license key


startTrial(): Promise<client.TrialActivationStatus>

Attempts to start a trial for the app.

Returns

The activation status of the trial


getTrialStatus(): Promise<client.TrialStatus>

Gets the current status of the trial for the app.

Returns

The current status of the trial


createLicenseKeyWindow(iconPath: string, urlToBuy: string, overrideAppName?: string): Promise<boolean>

Opens a window for entering a license key.

Parameters
  • iconPath The path to the app icon
  • urlToBuy The URL to purchase a license key
  • overrideAppName The name of the app to display in the window. If not provided, the appName provided in the constructor will be used.
Returns

A boolean that is true if the License was successfully activated, and false otherwise.