-
Notifications
You must be signed in to change notification settings - Fork 62
example proposal for html5 notification. #9
base: master
Are you sure you want to change the base?
Conversation
Thanks for submitting. At first glance, looks nice and clean. Will try to circle back soon and take a closer look. :) In the mean time, can you explain how the user permission is handled in the native API level, if at all? |
Natural behaviour of the api seem's that if the permission is not given nothing is displayed. |
Umm, I think we probably want to stick as closely to the semantics of the native API as possible. IMO, if the user denies permission to display, we should trust that they don't want to see it, and not try to second-guess them. However, it might be nice to provide an "event" that the app developer can listen for, which lets them know if the notification was denied to display. The app developer may choose to take other action based on knowing that. Events are a little bit of an in-flux thing with h5ive right now. My plan is to roll an "EventEmitter" type pubsub hub into the h5ive core, so that all plugins can publish events to that event hub, and then all app developers can listen for (namespaced, of course) events from each h5ive plugin in one place. Another thing that's in-flux is I want a common mechanism (not yet built) for feature-tests, where each plugin "registers" its feature-test with core, and then devs can have a simple way (sorta like modernizr) to test features via the h5ive core before using a plugin. I just haven't had time to build those features into the core yet, but that's my next set of things I want to do! For now, design the plugin as "stand alone" and not assuming any of that stuff, and we'll adjust plugins later once I get that done. :) |
I was also wondering about testing. Event is a really great way to deal to deal with an api, I use a lot backbone and the event handler is really powerful and simple to use. Did you consider using Grunt to run test and build lib? So I will focus on notification api, I hope I could help the best I can. |
notification = h5.notification(); | ||
|
||
notification | ||
.show({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to stick closer to the API for params like body
and icon
instead of content
and image
?
So this is a first draft of how could work notification system.
I'm wondering if we should leave the user permission in the constructor or make a separate method for it?
Thanks in advance for your feedback.