electron#systemPreferences JavaScript Examples

The following examples show how to use electron#systemPreferences. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From clipcc-desktop with GNU Affero General Public License v3.0 6 votes vote down vote up
askForMediaAccess = mediaType => {
    if (systemPreferences.askForMediaAccess) {
        // Electron currently only implements this on macOS
        // This returns a Promise
        return systemPreferences.askForMediaAccess(mediaType);
    }
    // For other platforms we can't reasonably do anything other than assume we have access.
    return true;
}
Example #2
Source File: permissions.js    From desktop with GNU General Public License v3.0 5 votes vote down vote up
askForMediaAccess = mediaType => {
  if (systemPreferences.askForMediaAccess) {
    return systemPreferences.askForMediaAccess(mediaTypeToPermissionType[mediaType]);
  }
  // TODO: for now we'll just assume we have access which is usually the case
  // in the future we should see if it's possible to detect this in snap and flatpak
  return true;
}