loadScript = (src, attrs) => {
    /**
     * @type {HTMLScriptElement}
     */
    let script = document.querySelector('script[src="' + src + '"]');

    return new Promise((resolve) => {
        if (script)
            return resolve(true);

        script = createNode('script');

        /**
         * Add custom attributes
         */
        if (isObject(attrs)) {
            for (const key in attrs) {
                setAttribute(script, key, attrs[key]);
            }
        }

        script.onload = () => resolve(true);
        script.onerror = () => {
            /**
             * Remove script from dom if error is thrown
             */
            script.remove();
            resolve(false);
        };

        script.src = src;

        appendChild(document.head, script);
    });
}
Dynamically load script (append to head)
@param {string} src
@param {{[key: string]: string}} [attrs] Custom attributes
@returns {Promise<boolean>} promise