|
|
Line 36: |
Line 36: |
| | | |
| // Watches a file for updates | | // Watches a file for updates |
| // handler takes the file's name and an UpdateType. | | // returns the DeviceStorageWatch for this request, through which future requests will be processed |
| // onError is an optional argument which is called if the process throws an error.
| | DeviceStorageWatch watchFileChange(DOMString name); |
| // type is intended to be a list (probably a bitfield) of event types to watch for, the options being creation, deletion, and modification.
| |
| // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions.
| |
| DOMRequest watchFileChange(DOMString name, Function handler, Function onError, UpdateType type); | |
| | | |
| // Watches all files for updates | | // Watches all files for updates |
| // handler takes the changed file's name and and an UpdateType
| | // returns the DeviceStorageWatch for this request, through which future requests will be processed |
| // onError is an optional argument which is called if the process throws an error.
| | DeviceStorageWatch watchChanges(); |
| // type is intended to be a list (probably a bitfield) of event types to watch for, the options being creation, deletion, and modification.
| |
| // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions. | |
| DOMRequest watchChanges(Function handler, Function onError, UpdateType type);
| |
|
| |
| // Watches for a file being renamed.
| |
| // handler takes the file's old name, and the file's new name
| |
| // onError is an optional argument which is called if the process throws an error.
| |
| // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions.
| |
| DOMRequest watchFileRename(DOMString name, Function handler, Function onError, UpdateType type);
| |
|
| |
| // Watches for any files being renamed
| |
| // handler takes the file's old name, and the file's new name
| |
| // onError is an optional argument which is called if the process throws an error.
| |
| // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions.
| |
| DOMRequest watchRenames(Function handler, Function onError, UpdateType type); | |
|
| |
| // Removes a watcher with the given id.
| |
| boolean removeWatch(PRInt32 id);
| |
| | | |
| // See interface below for how to use this | | // See interface below for how to use this |
Line 73: |
Line 52: |
| void continue(); | | void continue(); |
| }; | | }; |
| | |
| | interface DeviceStorageWatch : DOMRequest { |
| | // this function is called whenever the file(s) addressed by the request are created, modified, or deleted |
| | void onChange(DOMString name, UpdateType type); |
| | // this function is called whenever the file(s) addressed by the request are renamed |
| | void onRename(DOMSring oldName, DOMString newName); |
| | // this function stops the watcher permanently |
| | void cancel(); |
| | } |
|
| |
|
| The cursor API is somewhat different from the IndexedDB cursor in that it's a bit simpler. We might want to align more with IndexedDB just for the sake of consistency. | | The cursor API is somewhat different from the IndexedDB cursor in that it's a bit simpler. We might want to align more with IndexedDB just for the sake of consistency. |