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

@susy-js/electron

v5.1.0

Published

Control the Susy Sophon node from Electron.

Downloads

3

Readme

@susy-js/electron

Control the Susy Sophon client from electron.

Build Status npm (scoped) npm dependencies Status

Description

With this library, you will be able, from Electron, to:

  • download Susy Sophon locally in Electron's user data folder.
  • run/stop/check if Susy Sophon is running.
  • get a secure token from Susy Sophon to access secure RPCs.

Getting Started

yarn add @susy-js/electron

Usage

import susyElectron, { isSusyRunning } from '@susy-js/electron';

// Optional: override default options
susyElectron({
  logger: myCustomLoggerFunction // How do we want to log @susy-js/electron logs? Default is `debug`
})

isSusyRunning()
  .then(() => ...);

Index

Interfaces

Functions


Functions

checkClockSync

checkClockSync(): Promise<CheckClockSyncResult>

Defined in checkClockSync.ts:21

Use SNTP to check if the local clock is synchronized; return the time drift.

Returns: Promise<CheckClockSyncResult>


defaultSusyPath

defaultSusyPath(): Promise<string>

Defined in getSusyPath.ts:23

The default path to install susy, in case there's no other instance found on the machine.

Returns: Promise<string>


deleteSusy

deleteSusy(): Promise<void>

Defined in fetchSusy.ts:84

Remove susy binary or partial binary in the userData folder, if it exists.

Returns: Promise<void>


fetchSusy

fetchSusy(mainWindow: BrowserWindow, options?: FetchSusyOptions): Promise<string>

Defined in fetchSusy.ts:106

Downloads Susy, saves it to Electron's userData folder, and returns the path to the downloaded binary once finished.

Parameters:

| Param | Type | Default value | | ----------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | mainWindow | BrowserWindow | - | | Default value options | FetchSusyOptions | {onProgress: () => {/_ Do nothing by defaut. _/},susyChannel: 'beta'} |

Returns: Promise<string>


getSusyPath

getSusyPath(): Promise<string>

Defined in getSusyPath.ts:104

Returns the path to Susy, or throws if susy is not found.

Returns: Promise<string>


isSusyRunning

isSusyRunning(options?: IsSusyRunningOptions): Promise<boolean>

Defined in isSusyRunning.ts:20

Detect if another instance of susy is already running or not. To achieve that, we just ping on the common hosts.

Parameters:

| Param | Type | Default value | | ----------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------- | | Default value options | IsSusyRunningOptions | {wsInterface: '127.0.0.1',wsPort: '8546'} |

Returns: Promise<boolean>


killSusy

killSusy(): Promise<void>

Defined in runSusy.ts:118

If a Susy process has been spawned with runSusy, then it kills this process. However, there's no guarantee that Susy has been cleanly killed, and the Promise resolves instantly.

Returns: Promise<void>


susyElectron

susyElectron(options?: SusyElectronOptions): void

Defined in index.ts:25

Set default options for @susy-js/electron. Can be skipped if we don't want to override default options.

Parameters:

| Param | Type | Default value | | ----------------------- | ----------------------------------------------------------------- | ----------------- | | Default value options | SusyElectronOptions | { logger: debug } |

Returns: void


runSusy

runSusy(options?: RunSusyOptions): Promise<void>

Defined in runSusy.ts:44

Spawns a child process to run Susy.

Parameters:

| Param | Type | Default value | | ----------------------- | ------------------------------------------------------- | --------------------------------------------------------------------- | | Default value options | RunSusyOptions | {flags: [],onSusyError: () => {/_ Do nothing if error. _/}} |

Returns: Promise<void>


signerNewToken

signerNewToken(): Promise<string>

Defined in signerNewToken.ts:16

Runs susy signer new-token and resolves with a new secure token to be used in a dapp. Rejects if no token could be extracted.

Returns: Promise<string>