WebAPI/ProposedDeviceStorageAPIWithNotifications: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with "This page contains a draft of the proposed modification to the DeviceStorage API to include onchanged notifications. == API == partial interface Navigator { /** * type ...")
 
No edit summary
Line 34: Line 34:
   // Deletes a file
   // Deletes a file
   DOMRequest delete(DOMString name);
   DOMRequest delete(DOMString name);
 
   // Watches a file for updates: type is intended to be a list (probably a bitfield) of creation, deletion, and modification.
   // Watches a file for updates: type is intended to be a list (probably a bitfield) of creation, deletion, and modification.
   // handler takes the file's name and an event type.
   // handler takes the file's name and an event type.
Line 41: Line 41:
   DOMRequest watchFileChange(DOMString name, Function handler, Function onError, UpdateType type);
   DOMRequest watchFileChange(DOMString name, Function handler, Function onError, UpdateType type);
   
   
   // Watches all files for updates: type is intended to be a list (probably a bitfield) of creation, deletion, and modification.
   // Watches all files for updates: type is intended to be a list (probably a bitfield) of creation, deletion, and modification.
   // handler takes the changed file's name and and an event type
   // handler takes the changed file's name and and an event type
Line 47: Line 46:
   // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions.
   // 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);
   DOMRequest watchChanges(Function handler, Function onError, UpdateType type);
 
   // Watches for a file being renamed.
   // Watches for a file being renamed.
   // handler takes the file's old name, and the file's new name
   // handler takes the file's old name, and the file's new name
Line 54: Line 53:
   DOMRequest watchFileRename(DOMString name, Function handler, Function onError, UpdateType type);
   DOMRequest watchFileRename(DOMString name, Function handler, Function onError, UpdateType type);
   
   
   // Watches for any files being renamed
   // Watches for any files being renamed
   // handler takes the file's old name, and the file's new name
   // handler takes the file's old name, and the file's new name
Line 60: Line 58:
   // returns, in the DOMRequest's result field, an id that can be used to refer to this listener in other functions.
   // 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);
   DOMRequest watchRenames(Function handler, Function onError, UpdateType type);
 
   // Removes a watcher with the given id.
   // Removes a watcher with the given id.
   boolean removeWatch(PRInt32 id);
   boolean removeWatch(PRInt32 id);
 
   // See interface below for how to use this
   // See interface below for how to use this
   DeviceStorageCursor enumerate(optional DOMString directory)
   DeviceStorageCursor enumerate(optional DOMString directory)
Line 71: Line 69:
  interface DeviceStorageCursor : DOMRequest {
  interface DeviceStorageCursor : DOMRequest {
   // .result is either a File or a FileHandle
   // .result is either a File or a FileHandle
   void continue();
   void continue();
  };
  };
22

edits

Navigation menu