create-script.ts

25 lines | 679 B Blame History Raw Download
import { executeDrawQueue } from "../outputframe-app/injects/dom-helpers";

export function createScript(value: string) {
    var script: HTMLScriptElement = document.createElement("script");
    script.setAttribute("async", "");
    script.innerHTML = value;

    document.body.appendChild(script);

    executeDrawQueue();
}

export function createHtml(value: string) {
    var div: HTMLDivElement = document.createElement("div");
    div.innerHTML = value;

    document.body.appendChild(div);
}

export function createCss(value: string) {
    var style: HTMLStyleElement = document.createElement("style");
    style.innerHTML = value;

    document.body.appendChild(style);
}