Skip to content

Commit

Permalink
refactor: simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Jun 26, 2024
1 parent 43b86a9 commit 8798f3e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/pages/Checkout/CheckoutPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ export default {
isAboveCheckoutActions: false,
checkIsAboveCheckoutActionsThrottled: _throttle(this.checkIsAboveCheckoutActions, 100),
userOptedIn: false,
isMobile: false,
};
},
apollo: {
Expand Down Expand Up @@ -683,15 +682,12 @@ export default {
fireHotJarEvent('checkout_sticky_experiment');
}
this.determineIfMobile();
window.addEventListener('resize', this.throttledResize);
if (this.isMobile) {
if (window?.innerWidth < 735) {
this.initializeCheckoutStickyExperiment();
}
},
beforeDestroy() {
window.removeEventListener('scroll', this.checkIsAboveCheckoutActionsThrottled);
window.removeEventListener('resize', this.throttledResize);
},
computed: {
showCheckoutStickyExperiment() {
Expand Down Expand Up @@ -1207,12 +1203,6 @@ export default {
this.checkoutStickyExperimentEnabled = checkoutStickyExperiment.version === 'b';
}
},
determineIfMobile() {
this.isMobile = window?.innerWidth < 735;
},
throttledResize() {
return _throttle(this.determineIfMobile, 200);
},
},
destroyed() {
clearInterval(this.currentTimeInterval);
Expand Down

0 comments on commit 8798f3e

Please sign in to comment.