• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Event Broadcaster
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Event Broadcaster


  • Subject: Re: Event Broadcaster
  • From: Christian Brunschen <email@hidden>
  • Date: Tue, 27 Sep 2005 12:10:18 +0200 (CEST)



On Tue, 27 Sep 2005, Aaron Wallis wrote:

Hi there fellow cocoa developers.

I've got a question about events in Cocoa.
I need to build a events broadcaster class to assist in a large application im currently developing.


Let me define Events Broadcaster.

Basically, I need to construct a class that listens to every active object and can 'broadcast' events to anything thats listening.
A SUPER example of this is the ASBroadcaster object in ActionScript [ as in Macromedia Flash ActionScript] which distributes application wide events to that triggers functions in whoever is listening.


From an events perspective, im looking at 'listening' objects to call a self selector when the 'broadcaster' distributes an event, say for example:

[ myBroadcaster broadcastEvent:@"BigEvent" withParams:myArrayOfParams ];

and for the listeners to go
- onEventRecieve:(NSString)eventToCall :(NSArray)eventParams
{
   if ( //selector exists )
   {
       // self call event from string
   }
}

I understand that this could be done by passing each object a copy of a broadcaster object [ and for each sub class/object to get its parents broadcaster and so on] and just get the broadcaster to cycle through a dictionary of listening objects calling their selectors if they exist. but I was wondering if Cocoa had something like this already!?

NSNotification, NSNotificationCenter and NSDistributedNotificationCenter perchance ... ?


<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSNotificationCenter.html>

Any ideas?

Cheers and thanks in advance !

Best wishes,

_/Az.

// Christian Brunschen _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Event Broadcaster (From: Aaron Wallis <email@hidden>)

  • Prev by Date: Event Broadcaster
  • Next by Date: Re: substringWithRange: memory leak problem
  • Previous by thread: Event Broadcaster
  • Next by thread: CFMessagePort to NSMessagePort in IM context?
  • Index(es):
    • Date
    • Thread