News for hackers. Stuff that matters.
Re:Push API – W3C Working Draft by smanuel on Monday October 27, 2014 @05:35AM (#8514570)
> The push API is pretty awesome

The idea behind this is awesome (although we already have this for some platforms - e.g. https://developer.apple.com/library/mac/documentation/Networ...)

But the API looks over-engineered. e.g.

navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {

serviceWorkerRegistration.pushRegistrationManager.register().then(...

Re:Push API – W3C Working Draft by mmastrac on Monday October 27, 2014 @10:32AM (#8515619)
The new web APIs are promise-ified by default rather than using the callback model of the past. So rather than register(callback), it's register().then(...).

Whether this is a good thing or not is another question I don't know the answer to.

Re:Push API – W3C Working Draft by smanuel on Monday October 27, 2014 @10:45AM (#8515715)
My comment was mainly about serviceWorker.ready.then. I've never seen a JS API using such pattern - the name of the event as a property which is a promise.

A manager object/class also usually rings a bell.

Not that I'm an API specialist but I would rather implement it as:

document.addEventListener("serviceready", function() {

window.pushNotification.register().then(.....

Re:Push API – W3C Working Draft by AgentME on Monday October 27, 2014 @01:01PM (#8516667)
For an event that only happens once, then the

    navigator.serviceWorker.ready.then(function(){...
version is preferable to

    document.addEventListener("serviceready", function() {
because A) you don't have to worry about removing your event listener after the fact, and B) if the event has already happened, then your callback will be called immediately.
Re:Push API – W3C Working Draft by rakoo on Monday October 27, 2014 @06:57AM (#8514778)
I believe this spec is aiming to standardize the service offered primarily by Google (GCM) and Apple (APN), and open/standardize it for other people like pubnub/parse/pusher/...