All files _common.js

100% Statements 17/17
100% Branches 6/6
100% Functions 3/3
100% Lines 17/17

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 201x 1x 6x 6x 11x 11x 6x 11x 6x 6x   1x 5x 5x   1x 3x 3x 1x  
export class _common {
    static debounce(func, timeout = 300) {
        let timer;
        return (...args) => {
            clearTimeout(timer);
            timer = setTimeout(() => {
                func.apply(this, args);
            }, timeout);
        };
    }
 
    static genEvent(node, name, data, propagateToParents = true) {
        node.dispatchEvent(new CustomEvent(name, { detail: data, bubbles: propagateToParents }));
    }
 
    static getTag(node) {
        return node.tagName?.toLowerCase();
    }
}