- From: <ivan.demarino@orange-ftgroup.com>
- Date: Mon, 16 Mar 2009 19:15:29 +0100
- To: <scott.bradley.wilson@gmail.com>, <marcosc@opera.com>
- Cc: <arveb@opera.com>, <art.barstow@nokia.com>, <public-webapps@w3.org>
- Message-ID: <B877D90AB2240C4D84DF56169F1EAFED060F6745@ftrdmel3>
I agree with Scott's concern. I'm not 100% up-to-speed with the latest modification to the HTML5 specs (if any) but I remember that this kind of "Rubyesque" way of accessing elements in the Storage is only present into the "attached usage examples", but there is none in the API described in the document. So far I would avoid to implement stuff like that: in Javascript there is nothing, grammatically speaking. There could be a way, manipulating the Prototype object, doing things like: storageObject.setItem(key, value) { /* STORING CODE - DEPENDENT ON THE IMPLEMENTATION */ this.prototype.__defineGetter__(key, function() { /* CODE TO RETRIEVE THA VALUE FROM THE STORAGE - DEPENDENT ON THE IMPLEMENTATION */ }); } But I don't see it as very efficient and clean. I'm more for a "Java-ish"/classic set/get solution. Ivan De Marino Orange Labs Mobile and Web Software Engineer, R&D UK tel. +44 20 8849 5806 mob. +44 7515 955 861 mob. +44 7974 156 216 <mailto:firstname.lastname@orange-ftgroup.com> ivan.demarino@orange-ftgroup.com This e-mail, and any files transmitted with it, is intended only for the use of the person/s or entity to whom it is addressed. If you are not the intended recipient (or authorised to receive information for the intended recipient) you must not use, disclose, copy, print or rely on this e-mail. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and delete all copies of this e-mail. Thank you. France Telecom R&D UK Ltd is a company registered in England and Wales with company number 4193379. Our registered office is Minerva House, Montague Close, London, SE1 9BB. _____ From: public-webapps-request@w3.org [mailto:public-webapps-request@w3.org] On Behalf Of Scott Wilson Sent: 16 March 2009 17:33 To: marcosc@opera.com Cc: Arve Bersvendsen; Arthur Barstow; public-webapps@w3.org Subject: Re: [Widgets] APIs and Events preference change We've managed to implement Storage for Widget.preferences as an overlay over the older get/set method without any problems. One issue though is the HTML5 doc uses some syntax that relies on a Rubyesque method_missing capability that just isn't present in many environments, including, notably, JavaScript. E.g. the HTML 5 doc has this example: <label> <input type="checkbox" onchange="sessionStorage.insurance = checked"> I want insurance on this trip. </label> Now, we can handle this no problem: Widget.preferences.getItem("insurance") But: Widget.preferences.insurance ... poses a bit more of a challenge! Thoughts? S On 16 Mar 2009, at 11:57, Marcos Caceres wrote: 2009/3/9 Arve Bersvendsen <arveb@opera.com>: On Mon, 09 Mar 2009 12:20:25 +0100, Arthur Barstow <art.barstow@nokia.com> wrote: Note that there is a difference between localStorage and Storage. I am assuming that an implementation will place a (different) instance of a Storage interface on the widget.preferences object. This object would not be bound to the same storage instance as window.localStorage, and instead have its origin set to that of the widget (whatever URI scheme or origin we end up with once those issues are resolved), translated: The widget interface would not end up using the same storage area. This already seems to be permitted by the current spec, still residing in HTML5 [1], where there are two separate Storage instances in window.localStorage and window.sessionStorage This distinction is useful for widgets, as you could basically set one preference that only affects a single widget instance (sessionStorage), while other preferences affect all widgets of a particular class (localStorage). -- Marcos Caceres http://datadriven.com.au
Received on Monday, 16 March 2009 18:16:42 UTC