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

2.0.3 • Public • Published

@opendreamnet/app

npm version npm downloads

Utilities for OpenDreamNet applications.

Example

import * as app from '@opendreamnet/app'

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

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

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

// Object with bools
app.is
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'
}, '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()}

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.35latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.35
2.0.21
2.0.11
1.1.30

Package Sidebar

Install

npm i @opendreamnet/app

Weekly Downloads

7

Version

2.0.3

License

MIT

Unpacked Size

125 kB

Total Files

12

Last publish

Collaborators

  • kolessios