@dreamnet/app
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

@dreamnet/app

Version Downloads/week License

Utility functions for various applications.

Usage

import * as app from '@dreamnet/app'

// NodeJS: package.productName || package.displayName || package.name
// Browser: DreamApp
app.getName()

// Affects getName()
app.setName('My application')

// -> win32 || darwin || linux || android
app.getPlatform()

// Object with bools depending on the platform it is running on
app.is

// Examples:
app.is.browser // -> false
app.is.node // -> true
app.is.windows // -> false
app.is.linux // -> true
app.is.dev // NodeJS: process.env.NODE_ENV !== 'production' | Browser: null

// Allows you to select a value depending on `.is`
app.choice({
  windows: 'is windows!',
  linux: 'nice linux distribution',
  macos: 'cool mac'
}, 'default value: unknown os!') // -> "nice linux distribution"

// Works the same as `electron.getPath()` [https://www.electronjs.org/docs/api/app#appgetpathname]
// but without needing electron.
app.getPath('cwd') // -> /home/user/src/monorepo/workspaces/app
app.getPath('home') // -> /home/user
app.getPath('temp') // -> /tmp
app.getPath('appData') // -> /home/user/.config
app.getPath('userData') // -> /home/user/.config/DreamNet/${getName()}

Readme

Keywords

none

Package Sidebar

Install

npm i @dreamnet/app

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

829 kB

Total Files

10

Last publish

Collaborators

  • kolessios