h5ive-DEPRECATED
h5ive-DEPRECATED copied to clipboard
example proposal for html5 notification.
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.
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. I was thinking in a case of fail for permission, we could use an alert() method with a concatenation of title and content. So this way the message is still displayed to the user. Or it's better to stick to the html5 natural behaviour?
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. Something like selenium could be interesting in order to test in several browser each feature? Or QUnit could be an other solution. To tell you the truth I'm really wondering how to test some html5 feature (how to be sure that the notification has been displayed, it's not in the dom technically )
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.