forked from vuetifyjs/vuetify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointerSupport.js
More file actions
25 lines (22 loc) · 763 Bytes
/
pointerSupport.js
File metadata and controls
25 lines (22 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { addOnceEventListener } from './helpers'
/**
* @mixin
*/
export default {
mounted () {
const setupPointerSupport = (propName, eventName) => {
addOnceEventListener(window, eventName, () => {
this.$vuetify[propName] = true
const className = 'application--' + propName.replace(/([A-Z])/g, '-$1').toLowerCase()
document.querySelector('[data-app]').classList.add(className)
})
}
// Adds application--touch-support class
// after touchstart event is triggered
setupPointerSupport('touchSupport', 'touchstart')
// Add application--hover-support class
// after mouseover event is triggered
// Useless as per #869 in Modernizr
// setupPointerSupport('hoverSupport', 'mouseover')
}
}