WebAPI/DeviceIndexedDB: Difference between revisions

Line 85: Line 85:


Since "[SystemServices]" database is implemented by the platform code, writing actions may be forbidden by the implementation according the security model of the data.
Since "[SystemServices]" database is implemented by the platform code, writing actions may be forbidden by the implementation according the security model of the data.
=== Expose Network Statistic of Apps ==
This is an example of exposing network statistics of Apps with DeviceIndexedDB.
var request = window.mozDeviceIndexedDB.open("[SystemServices]");
request.onsuccess = function () {
  var db = request.result;
  var tx = db.transaction("NetworkStatistics");
  var store = tx.objectStore("NetworkStatistics");
  var apps = store.index("apps");
  var statisrequest = apps.get("some-app-id");
  statisrequest.onsuccess = function () {
    var statistic = statisrequest.result;
    showStatisticForApp(statistic);
  }
}
Confirmed users
398

edits