Skip to content

Commit

Permalink
Fixes bugs in composable
Browse files Browse the repository at this point in the history
  • Loading branch information
akolson committed Sep 30, 2022
1 parent e43b5a0 commit fca8437
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions lib/KResponsiveWindow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from '@vue/composition-api';
import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from 'vue';

function windowMetrics() {
return {
Expand All @@ -7,10 +7,6 @@ function windowMetrics() {
};
}

function isNuxtServerSideRendering() {
return process && process.server;
}

function addMediaQuery(query, callback) {
const mediaQueryList = window.matchMedia(query);
const eventHandler = event => {
Expand All @@ -29,11 +25,7 @@ function addMediaQuery(query, callback) {
};
}

if (!isNuxtServerSideRendering()) {
//Do nothing for now. Remove after testing
}

export default function KResponsiveWindow() {
export default function useResponsiveWindow() {
const windowWidth = ref(null);
const windowHeight = ref(null);
const windowBreakpoint = ref(null);
Expand Down Expand Up @@ -102,7 +94,7 @@ export default function KResponsiveWindow() {
});

const _updateGutter = () => {
if (windowIsSmall) {
if (windowIsSmall.value) {
windowGutter.value = 16;
} else if (_smallestWindowDimensionIsLessThan(600)) {
windowGutter.value = 16;
Expand Down

0 comments on commit fca8437

Please sign in to comment.