W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Web Alarm API - idiomatic check

From: Jake Verbaten <raynos2@gmail.com>
Date: Wed, 8 May 2013 11:07:02 -0700
Message-ID: <CAMCMjp3xKMUR+qvjB48M-R1HhqRHiYW8+OTn3KHTUD1O92G=WQ@mail.gmail.com>
To: Marcos Caceres <w3c@marcosc.com>
Cc: public-script-coord <public-script-coord@w3.org>
Look at the alarms api it's not obvouis how to get the id to remove an
alarm from.

```
var request = navigator.alarms.add(date, "ignoreTimezone", {
    message: "Your soup is ready!"
});
navigator.alarms.remove(request.id)
```

Should I read `request.id` to get the request? If we can only get the id
when the request resolves then it doesnt make sense to remove the alarm
once the alarm has already triggered.

It may be useful to have a recurring alarm primitive similar to setInterval.

If you want a pretty API consider parsing cron patterns (
http://crontab.org/ ) like node's cron module does (
https://github.com/ncb000gt/node-cron#another-cron-example )


On Wed, May 8, 2013 at 10:54 AM, Marcos Caceres <w3c@marcosc.com> wrote:

> Hi,
> The SysApps WG would appreciate if the JS folks could take a look at:
> http://web-alarms.sysapps.org/
> (it's nice and small, promise)
>
>
> And provide us some feedback on the idiomatic aspects (i.e., to make sure
> it isn't "another crap W3C API").
>
> A disclaimer: The API's name is terrible, we know that (should be called
> Web Cron or Web Scheduled Tasks or something less awful). We've tried to
> use Futures, but we are new to them.
>
> Anyway, any/all, comments welcome.  If you want to file bugs directly (or
> see what bugs we have open):
> https://github.com/sysapps/web-alarms/issues/ (
> https://github.com/sysapps/web-alarms/issues/new)
>
> Kind regards,
> Marcos
>
>
>
>
>
Received on Wednesday, 8 May 2013 18:07:39 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC