PairDrop/public/scripts/util-main.js

17 lines
No EOL
487 B
JavaScript

// Selector shortcuts
const $ = query => document.getElementById(query);
const $$ = query => document.querySelector(query);
class Events {
static fire(type, detail = {}) {
window.dispatchEvent(new CustomEvent(type, { detail: detail }));
}
static on(type, callback, options) {
return window.addEventListener(type, callback, options);
}
static off(type, callback, options) {
return window.removeEventListener(type, callback, options);
}
}