Skip to content

Commit

Permalink
Feat: Add optional width parameter to isMobile() method
Browse files Browse the repository at this point in the history
  • Loading branch information
NihadBadalov committed Feb 14, 2024
1 parent cf2d603 commit 45c03c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mixins/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ export default {
},

computed: {
isMobile() {
return this.windowWidth <= 767.98;
/**
* @param {number? | undefined} width Width of the device
* @returns {boolean} Whether the device is mobile
*/
isMobile(width) {
return (width && typeof width === "number"
? width ?? this.windowWidth
: this.windowWidth) <= 767.98;
},
},

Expand Down

0 comments on commit 45c03c2

Please sign in to comment.