Clean up appHost and shell method checking.
This commit is contained in:
parent
17b3a2aa05
commit
c4e87eb562
2 changed files with 13 additions and 11 deletions
|
@ -1,29 +1,29 @@
|
|||
// TODO: This seems like a good candidate for deprecation
|
||||
export default {
|
||||
enableFullscreen: function() {
|
||||
if (window.NativeShell && window.NativeShell.enableFullscreen) {
|
||||
if (window.NativeShell?.enableFullscreen) {
|
||||
window.NativeShell.enableFullscreen();
|
||||
}
|
||||
},
|
||||
disableFullscreen: function() {
|
||||
if (window.NativeShell && window.NativeShell.disableFullscreen) {
|
||||
if (window.NativeShell?.disableFullscreen) {
|
||||
window.NativeShell.disableFullscreen();
|
||||
}
|
||||
},
|
||||
openUrl: function(url, target) {
|
||||
if (window.NativeShell) {
|
||||
if (window.NativeShell?.openUrl) {
|
||||
window.NativeShell.openUrl(url, target);
|
||||
} else {
|
||||
window.open(url, target || '_blank');
|
||||
}
|
||||
},
|
||||
updateMediaSession(mediaInfo) {
|
||||
if (window.NativeShell && window.NativeShell.updateMediaSession) {
|
||||
if (window.NativeShell?.updateMediaSession) {
|
||||
window.NativeShell.updateMediaSession(mediaInfo);
|
||||
}
|
||||
},
|
||||
hideMediaSession() {
|
||||
if (window.NativeShell && window.NativeShell.hideMediaSession) {
|
||||
if (window.NativeShell?.hideMediaSession) {
|
||||
window.NativeShell.hideMediaSession();
|
||||
}
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export default {
|
|||
* Useful for e.g. remote playback.
|
||||
*/
|
||||
updateVolumeLevel(volume) {
|
||||
if (window.NativeShell && window.NativeShell.updateVolumeLevel) {
|
||||
if (window.NativeShell?.updateVolumeLevel) {
|
||||
window.NativeShell.updateVolumeLevel(volume);
|
||||
}
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ export default {
|
|||
* @returns true on success
|
||||
*/
|
||||
downloadFiles(items) {
|
||||
if (window.NativeShell) {
|
||||
if (window.NativeShell?.downloadFile) {
|
||||
items.forEach(item => window.NativeShell.downloadFile(item));
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue