mirror of
https://github.com/danbulant/Nertivia-Client
synced 2026-06-18 05:51:11 +00:00
29 lines
No EOL
596 B
JavaScript
29 lines
No EOL
596 B
JavaScript
|
|
import Vue from "vue";
|
|
import throttle from "lodash/throttle";
|
|
|
|
const WindowProperties = new Vue({
|
|
data () {
|
|
return {
|
|
resizeWidth: 0,
|
|
resizeHeight: 0,
|
|
}
|
|
},
|
|
created() {
|
|
this.resizeWidth = window.innerWidth;
|
|
this.resizeHeight = window.innerHeight;
|
|
|
|
this.debouncedResize = throttle(this.onResize, 70);
|
|
window.addEventListener("resize", this.debouncedResize);
|
|
|
|
|
|
},
|
|
methods: {
|
|
onResize() {
|
|
this.resizeWidth = window.innerWidth;
|
|
this.resizeHeight = window.innerHeight;
|
|
}
|
|
}
|
|
})
|
|
|
|
export default WindowProperties; |