diff options
author | Evgeny Zinoviev <reg@ch1p.com> | 2018-12-26 00:00:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-26 00:00:59 +0300 |
commit | b185113dd291ce5d094b958c4e3d0690f4bebb9e (patch) | |
tree | 4f02af2fe4e653fbf2e7b078c7149d141925718c /README.md | |
parent | 2e4bb8471d80a341c2439ef6d6b0bcd929e72abc (diff) |
write usable readme
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -1 +1,41 @@ # mojave-permissions + +This is native nodejs module that implements access to `getMediaAccessStatus` and `askForMediaAccess` functions introduced in macOS Mojave 10.14. + +## Building + +``` +node-gyp configure +node-gyp build +``` + +And you can check if it works: +``` +node test.js +``` + +Tested on macOS 10.14 and 10.13 with nodejs 11.3.0 and Electron 1.8.8 (node 8.2.1). + +## API + +### getMediaAccessStatus(mediaType) + +**mediaType** is a string and can be `microphone` or `camera` + +Returns one of the following values: `not-determined`, `restricted`, `denied` or `granted` + +### askForMediaAccess(mediaType, callback) + +Asks user for media access and returns user choice to the callback. Example: + +``` +mojavePermissions.askForMediaAccess('camera', (granted) => { + if (!granted) { + // user has denied access to camera + } +}) +``` + +## License + +I don't care; you can use it however you want. |