jellyfin-web/dashboard-ui/cordova/android/nativedirectorychooser.js

31 lines
673 B
JavaScript
Raw Normal View History

2015-06-09 21:01:14 -07:00
(function () {
var currentDeferred;
function chooseDirectory() {
var deferred = DeferredBuilder.Deferred();
AndroidDirectoryChooser.chooseDirectory();
currentDeferred = deferred;
return deferred.promise();
}
function onChosen(path) {
var deferred = currentDeferred;
if (deferred) {
if (path) {
deferred.resolveWith(null, [path]);
} else {
deferred.reject();
}
currentDeferred = null;
}
}
window.NativeDirectoryChooser = {
chooseDirectory: chooseDirectory,
onChosen: onChosen
};
})();