WebAPI/DataStore: Difference between revisions

Line 66: Line 66:
     // Returns the label of the DataSource.
     // Returns the label of the DataSource.
     readonly attribute DOMString name;
     readonly attribute DOMString name;
   
 
     // Returns the origin of the DataSource (e.g., 'facebook.com').
     // Returns the origin of the DataSource (e.g., 'facebook.com').
     // This value is the manifest URL of the owner app.
     // This value is the manifest URL of the owner app.
Line 73: Line 73:
     // is readOnly a F(current_app, datastore) function? yes
     // is readOnly a F(current_app, datastore) function? yes
     readonly attribute boolean readOnly;
     readonly attribute boolean readOnly;
      
 
     Promise<Object> get(int id);
     // Promise<any>
     Promise<void>   update(int id, Object obj);
     Promise get(unsigned long id);
     Promise<int>    add(Object obj);
 
     Promise<boolean> remove(int id);
    // Promise<any>
     Promise<void>   clear();
    Promise get(sequence<unsigned long> id);
   
 
     // Promise<void>
    Promise update(unsigned long id, any obj);
 
     // Promise<unsigned long>
     Promise add(any obj);
 
     // Promise<boolean>
    Promise remove(unsigned long id);
 
     // Promise<void>
    Promise clear();
 
     readonly attribute DOMString revisionId;
     readonly attribute DOMString revisionId;
   
 
     attribute EventHandler onchange;
     attribute EventHandler onchange;
     Promise<DataStoreChanges> getChanges(DOMString revisionId);
 
   
     // Promise<DataStoreChanges>
     // TODO: getAll(), getLength().
    Promise getChanges(DOMString revisionId);
 
     // Promise<unsigned long>
    Promise getLength();
  };
 
  dictionary DataStoreChanges {
    DOMString revisionId;
    sequence<unsigned long> addedIds;
    sequence<unsigned long> updatedIds;
    sequence<unsigned long> removedIds;
  };
 
  dictionary DataStoreChangeEventInit : EventInit {
    DOMString revisionId = "";
    unsigned long id = 0;
    DOMString operation = "";
   };
   };
    
    
   interface DataStoreChanges {
  [Constructor(DOMString type, optional DataStoreChangeEventInit eventInitDict)]
   interface DataStoreChangeEvent : Event {
     readonly attribute DOMString revisionId;
     readonly attribute DOMString revisionId;
     readonly attribute int[] addedIds;
     readonly attribute unsigned long id;
     readonly attribute int[] updatedIds;
     readonly attribute DOMString operation;
    readonly attribute int[] removedIds;
  }
 
  partial interface Navigator {
    Promise<sequence<DataStore>> getDataStores(DOMString name);
   };
   };


Confirmed users
53

edits