GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — lowcode-engine/packages/utils/src/script.ts at main · stantoxt/lowcode-engine Expand file tree/ Copy pathscript.tsMore file actions 56 lines (44 loc) · 1.24 KB / Copy pathscript.tsFile metadata and controls56 lines (44 loc) · 1.24 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 import { createDefer } from './create-defer'; export function evaluate(script: string) { const scriptEl = document.createElement('script'); scriptEl.text = script; document.head.appendChild(scriptEl); document.head.removeChild(scriptEl); } export function load(url: string) { const node: any = document.createElement('script'); // node.setAttribute('crossorigin', 'anonymous'); node.onload = onload; node.onerror = onload; const i = createDefer(); function onload(e: any) { node.onload = null; node.onerror = null; if (e.type === 'load') { i.resolve(); } else { i.reject(); } // document.head.removeChild(node); // node = null; } node.src = url; // `async=false` is required to make sure all js resources execute sequentially. node.async = false; document.head.appendChild(node); return i.promise(); } export function evaluateExpression(expr: string) { // eslint-disable-next-line no-new-func const fn = new Function(expr); return fn(); } export function newFunction(args: string, code: string) { try { // eslint-disable-next-line no-new-func return new Function(args, code); } catch (e) { console.warn('Caught error, Cant init func'); return null; } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |