Platforms to show: All Mac Windows Linux Cross-Platform
NSDistributedNotificationCenterMBS class
Super class: NSNotificationCenterMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Notifications | MBS MacBase Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
It takes NSNotification objects and broadcasts them to any objects in other tasks that have registered for the notification with their task's default distributed notification center.
The NSDistributedNotificationCenter class implements a notification center that can distribute notifications asynchronously to tasks other than the one in which the notification was posted. An instance of this class are known as a distributed notification center.
Each task has a default distributed notification center that you access with the defaultCenter class method. There may be different types of distributed notification centers. Currently there is a single type—NSLocalNotificationCenterType. This type of distributed notification center handles notifications that can be sent between tasks on a single computer. For communication between tasks on different computers, use Distributed Objects Programming Topics.
Posting a distributed notification is an expensive operation. The notification gets sent to a system-wide server that distributes it to all the tasks that have objects registered for distributed notifications. The latency between posting the notification and the notification's arrival in another task is unbounded. In fact, when too many notifications are posted and the server's queue fills up, notifications may be dropped.
Subclass of the NSNotificationCenterMBS class.
- property suspended as boolean
- 4 methods
- method addObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant, suspensionBehavior as Integer)
- method Constructor
- method postNotificationName(name as string, theObject as string, userInfo as dictionary, deliverImmediately as boolean)
- method postNotificationName(name as string, theObject as string, userInfo as dictionary, options as UInt32)
- 3 shared methods
- shared method defaultCenter as NSDistributedNotificationCenterMBS
- shared method notificationCenterForType(name as string) as NSDistributedNotificationCenterMBS
- shared method NSLocalNotificationCenterType as string
- 6 constants
Constants
Constant | Value | Description |
---|---|---|
NSNotificationDeliverImmediately | 1 |
One of the option constants to specify the behavior of notifications posted using the postNotificationName method.
When set, the notification is delivered immediately to all observers, regardless of their suspension behavior or suspension state. When not set, allows the normal suspension behavior of notification observers to take place. |
NSNotificationPostToAllSessions | 2 |
One of the option constants to specify the behavior of notifications posted using the postNotificationName method.
When set, the notification is posted to all sessions. When not set, the notification is sent only to applications within the same login session as the posting task. |
NSNotificationSuspensionBehaviorCoalesce | 2 |
One of the constants to specify the types of notification delivery suspension behaviors.
The server only queues the last notification of the specified name and object; earlier notifications are dropped. In cover methods for which suspension behavior is not an explicit argument, NSNotificationSuspensionBehaviorCoalesce is the default. |
NSNotificationSuspensionBehaviorDeliverImmediately | 4 |
One of the constants to specify the types of notification delivery suspension behaviors.
The server delivers notifications matching this registration irrespective of whether Suspended is set to true. When a notification with this suspension behavior is matched, it has the effect of first flushing any queued notifications. The effect is as if setSuspended: with an argument of false were first called if the application is suspended, followed by the notification in question being delivered, followed by a transition back to the previous suspended or unsuspended state. |
NSNotificationSuspensionBehaviorDrop | 1 |
One of the constants to specify the types of notification delivery suspension behaviors.
The server does not queue any notifications with this name and object until Suspended is set to false. |
NSNotificationSuspensionBehaviorHold | 3 |
One of the constants to specify the types of notification delivery suspension behaviors.
The server holds all matching notifications until the queue has been filled (queue size determined by the server), at which point the server may flush queued notifications. |
Super class NSNotificationCenterMBS
- property Handle as Integer
- 8 methods
- method addObserver(observer as NSNotificationObserverMBS, name as string="", theObject as Variant=nil)
- method Constructor
- method postNotification(notification as NSNotificationMBS)
- method postNotificationName(name as string)
- method postNotificationName(name as string, theObject as Variant)
- method postNotificationName(name as string, theObject as Variant, userInfo as dictionary)
- method removeObserver(observer as NSNotificationObserverMBS)
- method removeObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant=nil)
- shared method defaultCenter as NSNotificationCenterMBS
This class has no sub classes.
Some examples using this class:
- /MacCG/CoreText/CoreText Font Change Notification
- /MacCocoa/Notifications/NSDistributedNotificationCenterMBS receiver
- /MacCocoa/Notifications/NSDistributedNotificationCenterMBS sender
Blog Entries
The items on this page are in the following plugins: MBS MacBase Plugin.
NSDirectoryEnumeratorMBS - NSDockTileMBS