Build Notification Center in javascript
I'm building a small app in js, using the mvc pattern. I want to separate totally the view and the control so I though a notification center control would be a good solution. UI objec开发者_JAVA百科ts fire a notification with data attached in which is recorded the id, the event and other data.
You think is a good solution?
Which could be wise ways to implement this?
Thanks
Try to write something like EventEmitter
in nodejs.
https://github.com/tmpvar/node-eventemitter
Yes. I think it's a good idea to implement the Observer pattern (Notification Center) in user interfaces; specifically because doing so allows you to easily add features and functionality later in the life of the application. I think it would be wise to implement the Observer Design Pattern for your Notification Center. You should consider reading Apple's implementation of their Cocoa Framework's Notification Center for inspiration and examples on usage.
精彩评论