Skip to content

ElectronSystemPreferences.subscribeNotification method

ElectronSystemPreferences › subscribeNotification

Unofficial

Subscribes to native notifications of macOS, callback will be called with callback(event, userInfo) when the corresponding event happens. If event is null, the NSDistributedNotificationCenter doesn't use it as criteria for delivery to the observer.

Signature:

subscribeNotification($event: string | null, callback: ($event: string, userInfo: Record<string, unknown>, $object: string) => void): number

Parameters:

ParameterTypeDescription
$eventstring | null
callback($event: string, userInfo: Record<string, unknown>, $object: string) => voidCalled when the corresponding event happens.

Returns: number — The ID of this subscription.

Platform: darwin.