mozilla
Your Search Results

    DeviceStorage.onchange

    This article is in need of a technical review.

    Non-standard
    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

    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

    instanceOfDeviceStorage.onchange = funcRef

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

    Example

    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

    Document Tags and Contributors

    Contributors to this page: kscarfone, jsx, fscholz, Jeremie
    Last updated by: fscholz,