mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
31 lines
673 B
JavaScript
31 lines
673 B
JavaScript
|
(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
|
|||
|
};
|
|||
|
|
|||
|
})();
|