Skip to content

Instantly share code, notes, and snippets.

@cosenal
Created May 22, 2015 15:56
Show Gist options
  • Save cosenal/314d475d9c200db0bdda to your computer and use it in GitHub Desktop.
Save cosenal/314d475d9c200db0bdda to your computer and use it in GitHub Desktop.
device storage -- minimum working example
(function () {
var files = navigator.getDeviceStorage('pictures');
var cursor = files.enumerate();
console.log(cursor);
cursor.onsuccess = function() {
if (this.done) {
console.log("Done");
}
else {
console.log(this.result);
this.continue();
}
};
cursor.onerror = function() {
console.log(cursor.error);
};
})();
<!DOCTYPE html>
<html lang="en" ng-app="uploadApp">
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1" />
<meta charset="utf-8">
<title>Device Storage MWE</title>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
</body>
</html>
{
"name": "Device Storage MWE",
"description": "device storage MWE",
"launch_path": "/index.html",
"type": "privileged",
"permissions": {
"device-storage:pictures": {
"access": "readonly",
"description": "photo backup"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment