All files / js/utils index.js

18.75% Statements 3/16
0% Branches 0/5
0% Functions 0/5
21.43% Lines 3/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 26 271x   1x               1x                                
export const uuid = (prefix = '') => prefix + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
 
export const ready = (handler) => {
	if (/complete|loaded|interactive/.test(document.readyState) && document.body) {
		handler();
	} else {
		document.addEventListener('DOMContentLoaded', handler, false);
	}
};
 
export const detectSupportsPassive = () => {
	let supportsPassive = false;
 
	try {
		let opts = Object.defineProperty({}, 'passive', {
			get() {
				supportsPassive = true;
				return true;
			}
		});
 
		window.addEventListener('testPassive', null, opts);
		window.removeEventListener('testPassive', null, opts);
	} catch (e) {}
 
	return supportsPassive;
};