W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: [File API: Directories and System] callbacks or events

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Tue, 15 Feb 2011 13:46:41 +0200
Message-ID: <4D5A67A1.4040309@helsinki.fi>
To: Eric Uhrhane <ericu@google.com>
CC: public-webapps@w3.org
On 02/12/2011 01:08 AM, Eric Uhrhane wrote:
> On Fri, Feb 11, 2011 at 7:43 AM, Olli Pettay<Olli.Pettay@helsinki.fi>  wrote:
>> Hi all,
>>
>> the current "File API: Directories and System" seems to use
>> callbacks and not events, yet other
>> File APIs (the ones for read and write) use events.
>> That is quite major inconsistency in the APIs.
>> IIRC there was already some discussion about which approach to use
>> when the API for read was designed and it was decided that events should be
>> used.
>>
>> Using events would make it rather easy to track moves, copies etc, of a
>> file. Just set the event listeners when the entry is first time
>> accessed, and then you get notified whenever the file is moved etc.
>
> FileReader and FileWriter are fundamentally different than FileSystem.
>   Reading or writing a file is an ongoing process, hence progress
> events make a lot of sense.  Getting a file handle, deleting a file,
> creating a directory, etc., are all very binary.  They've happened or
> they haven't, and there's no progress to report.  Thus callbacks make
> sense for those operations.
>
> It sounds like you're looking for some sort of a FileSystemWatcher
> object that would let you keep track of everything that's happening in
> a filesystem.
No I'm not, although using events would give that kind of
functionality for free.
I'm looking for API consistency.



-Olli



  That's not a request I've heard before; if you've got
> specific use cases in mind, please post them.
>
>        Eric
>
>
Received on Tuesday, 15 February 2011 12:53:45 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:43 GMT