- From: Marcos Caceres <marcosscaceres@gmail.com>
- Date: Mon, 11 Feb 2013 22:05:05 +0000
- To: public-sysapps@w3.org
The spec says: > > The second argument respectTimezone can be either "respectTimezone" or "ignoreTimezone" to This seems to be a boolean in disguise:) Also, why is this a required argument? In most cases, you want to "respectTimezone", right? I can see the logic of having it as a string instead of a boolean (legibility), but if you are going to keep it as a string camelCasing seems annoying. Maybe we can find a way of shortening it or use a dictionary to avoid the following case if it's made optional: var time = new Date("June 29, 2012 07:30:00"); //this would be kinda sucky… navigator.alarms.add(time, undefined, { mydata: "foo" }); If an optional dictionary was used, then it can become: var mydata = {foo: "fum"}; navigator.alarms.add(time, {respectTimezone: false , data: mydata}); //or, respectTimezone is always true, so we just omit it navigator.alarms.add(time, {data: mydata}); And that would be nicer in that respectTimezone is now and actual boolean (instead of a string masquerading as a boolean), and it's clear what it is when the code is read. And it avoids the "undefined" hole for an optional value. It also allows the API to be extended in the future if need be by simply adding new items to the dictionary. If you like the proposal, please chance/add: interface AlarmManager : EventTarget { AlarmRequest add(Date date, optional AlarmInit); ... }; dictionary AlarmInit { boolean respectTimezone = true; object data; }; -- Marcos Caceres http://datadriven.com.au
Received on Monday, 11 February 2013 22:05:35 UTC