Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSNotificationCenterMBS class.

NSNotificationCenterMBS.addObserver(observer as NSNotificationObserverMBS, name as string="", theObject as Variant=nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Adds an entry to the receiver's dispatch table with an observer and optional criteria: notification name and sender.

observer: Object registering as an observer. This value must not be nil.
name: The name of the notification for which to register the observer; that is, only notifications with this name are delivered to the observer. If you pass nil, the notification center doesn't use a notification's name to decide whether to deliver it to the observer.
theObject: The object whose notifications the observer wants to receive; that is, only notifications sent by this sender are delivered to the observer. If you pass nil, the notification center doesn't use a notification's sender to decide whether to deliver it to the observer.

NSNotificationCenterMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
The constructor to create a new instance of notification center pointing to the default notification center.

The current task's default notification center, which is used for system notifications.

NSNotificationCenterMBS.postNotification(notification as NSNotificationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Posts a given notification to the receiver.

notification: The notification to post. This value must not be nil.

NSNotificationCenterMBS.postNotificationName(name as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a notification with a given name and sender and posts it to the receiver.

name: The name of the notification.
theObject: The object posting the notification.

See also:

NSNotificationCenterMBS.postNotificationName(name as string, theObject as Variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a notification with a given name and sender and posts it to the receiver.

name: The name of the notification.
theObject: The object posting the notification.

See also:

NSNotificationCenterMBS.postNotificationName(name as string, theObject as Variant, userInfo as dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a notification with a given name, sender, and information and posts it to the receiver.

name: The name of the notification.
theObject: The object posting the notification.
userInfo: Information about the the notification. May be nil.

This method is the preferred method for posting notifications.

See also:

NSNotificationCenterMBS.removeObserver(observer as NSNotificationObserverMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes all the entries specifying a given observer from the receiver's dispatch table.

observer: The observer to remove. Must not be nil.

Be sure to invoke this method before notificationObserver or any object specified in addObserver is deallocated.

See also:

NSNotificationCenterMBS.removeObserver(observer as NSNotificationObserverMBS, name as string, theObject as Variant=nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Notifications MBS MacBase Plugin 9.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes matching entries from the receiver's dispatch table.

notificationObserver: Observer to remove from the dispatch table. Specify an observer to remove only entries for this observer. Must not be nil, or message will have no effect.
notificationName: Name of the notification to remove from dispatch table. Specify a notification name to remove only entries that specify this notification name. When nil, the receiver does not use notification names as criteria for removal.
notificationSender: Sender to remove from the dispatch table. Specify a notification sender to remove only entries that specify this sender. When nil, the receiver does not use notification senders as criteria for removal.

Be sure to invoke this method before the observer object or any object specified in addObserver is deallocated.

See also:

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...