https://github.com/gch1p/mojave-permissions
node.js native addon for checking and requesting media permissions on macos
https://github.com/gch1p/mojave-permissions
electron macos mojave nodejs
Last synced: 4 months ago
JSON representation
node.js native addon for checking and requesting media permissions on macos
- Host: GitHub
- URL: https://github.com/gch1p/mojave-permissions
- Owner: gch1p
- Created: 2018-12-25T15:18:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-21T17:59:05.000Z (almost 6 years ago)
- Last Synced: 2025-10-09T01:09:19.911Z (9 months ago)
- Topics: electron, macos, mojave, nodejs
- Language: Objective-C++
- Size: 5.86 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.