@baggie/detection
Advanced tools
Comparing version 1.3.5 to 1.4.0
@@ -9,3 +9,3 @@ /** | ||
continuousDetection?: boolean; | ||
setClassOnElement?: HTMLElement; | ||
setClassOnElement?: HTMLElement | false; | ||
callback?: ({ isMouse, isTouch, }: { | ||
@@ -12,0 +12,0 @@ isMouse: boolean; |
@@ -16,2 +16,7 @@ "use strict"; | ||
} | ||
const element = this.settings.setClassOnElement; | ||
if (element) { | ||
element.classList.remove(this.settings.mouseClass || ""); | ||
element.classList.add(this.settings.touchClass || ""); | ||
} | ||
if (this.settings.callback) { | ||
@@ -23,7 +28,2 @@ this.settings.callback({ | ||
} | ||
else { | ||
const element = this.settings.setClassOnElement; | ||
element === null || element === void 0 ? void 0 : element.classList.remove(this.settings.mouseClass || ""); | ||
element === null || element === void 0 ? void 0 : element.classList.add(this.settings.touchClass || ""); | ||
} | ||
}; | ||
@@ -36,2 +36,7 @@ this.mouseMoved = () => { | ||
} | ||
const element = this.settings.setClassOnElement; | ||
if (element) { | ||
element.classList.remove(this.settings.touchClass || ""); | ||
element.classList.add(this.settings.mouseClass || ""); | ||
} | ||
if (this.settings.callback) { | ||
@@ -43,7 +48,2 @@ this.settings.callback({ | ||
} | ||
else { | ||
const element = this.settings.setClassOnElement; | ||
element === null || element === void 0 ? void 0 : element.classList.remove(this.settings.touchClass || ""); | ||
element === null || element === void 0 ? void 0 : element.classList.add(this.settings.mouseClass || ""); | ||
} | ||
} | ||
@@ -50,0 +50,0 @@ }; |
@@ -10,2 +10,2 @@ "use strict"; | ||
*/ | ||
exports.orientationIsLandscape = matchMedia_helper_1.matchMedia("(orientation: landscape)"); | ||
exports.orientationIsLandscape = (0, matchMedia_helper_1.matchMedia)("(orientation: landscape)"); |
@@ -10,2 +10,2 @@ "use strict"; | ||
*/ | ||
exports.orientationIsPortrait = matchMedia_helper_1.matchMedia("(orientation: portrait)"); | ||
exports.orientationIsPortrait = (0, matchMedia_helper_1.matchMedia)("(orientation: portrait)"); |
@@ -10,2 +10,2 @@ "use strict"; | ||
*/ | ||
exports.prefersDarkColorScheme = matchMedia_helper_1.matchMedia("(prefers-color-scheme: dark)"); | ||
exports.prefersDarkColorScheme = (0, matchMedia_helper_1.matchMedia)("(prefers-color-scheme: dark)"); |
@@ -10,2 +10,2 @@ "use strict"; | ||
*/ | ||
exports.prefersReducedMotion = dontMatchMedia_helper_1.dontMatchMedia("(prefers-reduced-motion: no-preference)"); | ||
exports.prefersReducedMotion = (0, dontMatchMedia_helper_1.dontMatchMedia)("(prefers-reduced-motion: no-preference)"); |
{ | ||
"name": "@baggie/detection", | ||
"version": "1.3.5", | ||
"version": "1.4.0", | ||
"description": "A library of detection tools for JavaScript and TypeScript. Detect browser support, media features, environment etc.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21540