Skip to content
This repository has been archived by the owner on Mar 25, 2019. It is now read-only.

example proposal for html5 notification. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

garciaf
Copy link

@garciaf garciaf commented Jun 30, 2013

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.

@getify
Copy link
Owner

getify commented Jun 30, 2013

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?

@garciaf
Copy link
Author

garciaf commented Jun 30, 2013

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?

@getify
Copy link
Owner

getify commented Jul 1, 2013

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. :)

@garciaf
Copy link
Author

garciaf commented Jul 1, 2013

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.

notification = h5.notification();

notification
.show({

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants