puremvc
|
 |
« Reply #1 on: August 07, 2009, 07:19:30 » |
|
The sendNotification method is a convenience, as is the notification body. Events don't allow passing data at all unless you create custom Event classes. With notifications, at least you can pass anything. If you want strongly typed notifications, you can eschew the sendNotification method and use the Facade's notifyObservers method. This means you'll need to create your own custom notification class and instantiate it yourself.
It won't do you a lot of good though, since the other end has to cast the notification to the correct type. You could add a method to the facade that does something like sendNotification but with a custom type, so that you can get code hints when you are sending the note.
Personally, I don't run into many issues with the broadly typed notification system. It gives me convenience and very little downside. When I'm working on the code for sending or receiving a notification I generally know what the use case needs and if I'm looking at someone elses app, I can pretty easily track down the senders and receivers and see what's going on. Thus, the hassle of having to create typed notes has never been one with much lure.
-=Cliff>
|