Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/browser/separate_metadata_later.cpp
4150 views
1
// Copyright 2018 The Emscripten Authors. All rights reserved.
2
// Emscripten is available under two separate licenses, the MIT license and the
3
// University of Illinois/NCSA Open Source License. Both these licenses can be
4
// found in the LICENSE file.
5
6
#include <emscripten.h>
7
8
EMSCRIPTEN_KEEPALIVE extern "C" void finish() {
9
REPORT_RESULT(1);
10
}
11
12
int main() {
13
EM_ASM({
14
setTimeout(function() {
15
// hijack run dep logic to see when the metadata is loaded ok.
16
var real = Module["removeRunDependency"];
17
Module["removeRunDependency"] = function(id) {
18
real(id);
19
if (id === "more.js.metadata") {
20
Module["_finish"]();
21
}
22
};
23
function loadChildScript(name, then) {
24
var js = document.createElement("script");
25
if (then) js.onload = then;
26
js.src = name;
27
document.body.appendChild(js);
28
}
29
loadChildScript("more.js");
30
}, 1);
31
});
32
}
33
34
35