JSPM

cf-prefs

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4505
  • Score
    100M100P100Q127498F
  • License MIT

A native node module to access managed app preferences on macOS

Package Exports

  • cf-prefs
  • cf-prefs/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cf-prefs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

MIT license PRs Welcome Actions Status

cf-prefs

$ yarn add cf-prefs

This native Node.js module allows you to read managed app preferences on macOS. It maps to the underlying CFPreferencesCopyAppValue family of APIs. This module only truly works in apps with valid bundle IDs (i.e. Electron apps).

API

prefs.getPreferenceValue(key)

  • key String - The preference key to fetch the value of, has to be a valid UTF-8 string.

Returns String | Integer | Boolean | Object | Array | undefined

Notes:

  • If the preference is not available you will receive undefined.

Example:

console.log('My Preference Value:', prefs.getPreferenceValue('MyAppsCoolPreference'))

permissions.isPreferenceForced(key)

  • key String - The preference key to determine if the value is forced, has to be a valid UTF-8 string.

Returns Boolean - Whether the preference key is "forced", if this method returns true you should not allow users to override this preference in your application as a system administrator has indicated this preference key is "forced". For more information check out the apple API docs.