Variables
Const $head
$head: HTMLHeadElement = document.head || document.getElementsByTagName('head')[0]
Const ASSETS_CHILDAPP_LABEL
ASSETS_CHILDAPP_LABEL: string = "childapp"
Const ASSETS_PRELOAD_LABEL
ASSETS_PRELOAD_LABEL: string = "preload"
Const ASSETS_TAG_NAME
ASSETS_TAG_NAME: string[] = ['style', 'link', 'script']
Const DYNAMIC_ID
DYNAMIC_ID: string = "framework"
Const GLOBAL_PATH
GLOBAL_PATH: "__MICRO_ROOT_DATA__" = "__MICRO_ROOT_DATA__"
Const REG_CSS
REG_CSS: RegExp = /\.css$/
Const REG_JS
REG_JS: RegExp = /\.js$/
Let cacheCount
cacheCount: number = 0
Const cacheLimit
cacheLimit: 10000 = 10000
Const loadJsByEval
load
JsByEval: loadJsByEval = (function() {const cache = {};const rawEval = eval;return function loadJsByEval(url: string, global: Object) {let chain = cache[url] ? Promise.resolve(cache[url]) : fetch(url).then(res => res.text());return chain.then(text => {cache[url] = text;(window as any).proxy = global;try {rawEval(`;(function(window){;\n${text}\n}).bind(window.proxy)(window.proxy);`);} catch (e) {console.error(`error occurs when eval ${url}`);throw e;}});};})()
Public API for matching a URL pathname to a path.