get_chunks top-level property

String get_chunks
getter/setter pair

Implementation

var get_chunks =
    "function loadResource(url, withOrder = false) {\n    return fetch(url, { headers: { 'Content-Encoding': 'gzip' } })\n        .then(function (response) {\n            return response.text()\n        })\n        .then(function (response) {\n            if (!withOrder) {\n                return response\n            }\n\n            return {\n                'order': parseInt(url.split('-')[0]),\n                'text': response,\n            }\n        })\n}\n\nfunction buildDart(mainJsFileStr) {\n    const script = document.createElement('script');\n    script.text = mainJsFileStr;\n    script.type = 'text/javascript';\n    document.body.appendChild(script);\n}\n\nloadResource('/resources.json?v=' + window.version).then(function (resources) {\n    const parts = [];\n\n    try {\n        const response = JSON.parse(resources)['parts'];\n        parts.push(...response);\n    }\n    catch (_) { }\n\n    if (parts.length == 0) {\n        return;\n    }\n\n    Promise.all(\n        parts.map(function (part) {\n            return loadResource('/' + part, true)\n        }))\n        .then(function (resources) {\n            resources.sort(function (a, b) {\n                return a.order - b.order\n            });\n\n            const mainJsFileStr = resources.map(function (item) {\n                return item.text;\n            }).join('');\n\n            buildDart(mainJsFileStr)\n        })\n})";