Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/custom_messages_proxy_postjs.js
4128 views
1
var customMessageData = '';
2
3
Module.onCustomMessage = function (message) {
4
var data = message.data.userData;
5
switch (data.op) {
6
case 'preMainCustomMessage': {
7
customMessageData += data.data;
8
break;
9
}
10
case 'runMain': {
11
postCustomMessage({ op: 'runningMain', data: customMessageData });
12
removeRunDependency('Custom Message Init');
13
break;
14
}
15
case 'postMainCustomMessage': {
16
customMessageData += data.data;
17
break;
18
}
19
case 'finish': {
20
postCustomMessage({ op: 'finishing', data: customMessageData + '[finish]' });
21
break;
22
}
23
default: {
24
throw 'unknown custom message';
25
}
26
}
27
28
}
29
30
addRunDependency('Custom Message Init');
31
32