electron-util
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/electron-util package

0.18.1 • Public • Published

electron-util

Useful utilities for Electron apps and modules

You can use this package directly in both the main and renderer process.

There are three parts of this package, “shared”, “main”, and “node”. The “shared” part works in both the main or rendered process. The “main” part works only in the main process. The “node” part is for Node.js-only APIs (not Electron).

To use features from the “main” part in the renderer process, you will need to set up IPC channels.

Install

npm install electron-util

[!NOTE] Requires Electron 28 or later.

Usage

The “shared” API you can access directly:

import {is} from 'electron-util';

console.log(is.macos && is.main);
//=> true

For the “main” API, use the /main sub-export:

import {isDev} from 'electron-util/main';

console.log(isDev);
//=> false

API

Documentation (The service is broken)

Look at the types for now.

Related

Package Sidebar

Install

npm i electron-util

Weekly Downloads

7,656

Version

0.18.1

License

MIT

Unpacked Size

49 kB

Total Files

49

Last publish

Collaborators

  • sindresorhus