Last active
December 17, 2015 21:59
-
-
Save nootanghimire/5678946 to your computer and use it in GitHub Desktop.
Trying to ue devisestorage api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var pickAnything = document.querySelector("#pick-anything"); | |
if (pickAnything) { | |
pickAnything.onclick = function() { | |
var storage = navigator.getDeviceStorage("sdcard"); | |
cursor = storage.enumerate(); | |
cursor.onerror = function() { | |
console.error("Error in DeviceStorage.enumerate()", cursor.error.name); //console shows this error | |
}; | |
cursor.onsuccess = function() { | |
if (!cursor.result) | |
alert('something'); | |
} | |
alert(cursor.result); | |
var file = cursor.result; | |
// Show file | |
alert(file.name); | |
console.log(file.name); | |
}; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment