-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
25 lines (22 loc) · 742 Bytes
/
utils.js
File metadata and controls
25 lines (22 loc) · 742 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
/*! Copyright (c) 2017-2018 Simon Dawson */
/* Get current timestamp */
const now = () => +new Date()
/* Is the passive property supported? */
const passive_supported = () => {
let rv = false
try {
/* Use a getter in the options object, to test whether the "passive"
* property is accessed */
const opts = Object.defineProperty({}, 'passive', {
get: function() {
rv = true
}
})
window.addEventListener('idle-timer:test', null, opts)
console.log('idle-timer: passive event listeners supported')
} catch (e) {
console.warn('idle-timer: passive event listeners not supported')
}
return rv
}
export { now, passive_supported }