This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save window size of app to portmaster after resize
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<span /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "Dashboard", | ||
components: { | ||
}, | ||
data() { | ||
return { | ||
updateID: 0 | ||
}; | ||
}, | ||
methods: { | ||
saveWindowSize() { | ||
// increase ID counter | ||
this.updateID++; | ||
// assign current ID to this instance | ||
let myUpdateID = this.updateID; | ||
// create function to check if loading has finished | ||
let save = () => { | ||
// only save if we are the last instance | ||
if (myUpdateID == this.updateID) { | ||
this.$api.update("core:ui/app/window", { | ||
// window.outer* don't work correctly with IE/MSHTML. | ||
Height: window.outerHeight - 50, // substract a little to compensate for top bar | ||
Width: window.outerWidth - 50, // substract a little to compensate for scroll bar | ||
}); | ||
} | ||
}; | ||
// save after one second | ||
setTimeout(save, 1000); | ||
} | ||
}, | ||
beforeMount() { | ||
window.addEventListener("resize", this.saveWindowSize); | ||
} | ||
}; | ||
</script> | ||
|
||
<!-- Add "scoped" attribute to limit CSS to this component only --> | ||
<style scoped lang="scss"> | ||
</style> |