DeviceStorage.onchange

This API is available on Firefox OS for privileged or certified applications only.

Summary

The onchange property is used to specify an event handler to receive change events. Those events are triggered each time a file is created, modified, or deleted on the storage area.

Syntax

JavaScript
instanceOfDeviceStorage.onchange = funcRef

Where funcRef is a function to be called when the change event occurs. These events are of type DeviceStorageChangeEvent.

Example

JavaScript
var sdcard = navigator.getDeviceStorage('sdcard');

sdcard.onchange = function (change) {
  var reason = change.reason;
  var path   = change.path;

  console.log('The file "' + path + '" has been ' + reason);
}

Specification

Not part of any specification.

See also

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/devicestorage/onchange

API B2G Device Storage Firefox OS Property Reference Référence WebAPI