node-mac-permissions icon indicating copy to clipboard operation
node-mac-permissions copied to clipboard

Get notified when perms are changed

Open KishanBagaria opened this issue 5 years ago • 2 comments

Is it possible to get notified when a particular permission is granted by the user, manually from System Preferences or through the prompt?

KishanBagaria avatar May 18 '20 14:05 KishanBagaria

@KishanBagaria - you can use getAuthStatus to poll for the status change.

glawson avatar May 21 '20 16:05 glawson

@KishanBagaria this is in theory possible using a similar approach to what's done in node-mac-contacts - i'd need to implement manual management of an EventEmitter since this isn't a class-based module. It might also be rather trickier because in this case we're needing to poll for a pretty wide range of notifications, each of which would need to be scaffolded up and torn down carefully to avoid leaks and crashes.

Like @glawson said you can for now poll with getAuthStatus() - i'd consider the event emission approach but it's gonna be a wild enough ride that i don't think i myself will have the cycles in the near future 🤔

codebytere avatar May 22 '20 01:05 codebytere