create-script.ts
Home
/
shared /
create-script.ts
import { executeDrawQueue } from "../outputframe-app/injects/dom-helpers";
export function createScript(value: string, appendToBody: boolean = true): HTMLScriptElement {
var script: HTMLScriptElement = document.createElement("script");
script.setAttribute("async", "");
script.innerHTML = value;
if (appendToBody) {
document.body.appendChild(script);
executeDrawQueue();
}
return script;
}
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);
}