-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsample-requirejs.js
57 lines (53 loc) · 1.36 KB
/
sample-requirejs.js
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
57
define(function (require) {
var mscgenjs = require("../../dist/bundle/index.min");
function render() {
window.output.innerHTML = "";
mscgenjs.renderMsc(
window.inputscript.value,
{
inputType: "xu",
elementId: "output",
additionalTemplate: "lazy",
mirrorEntitiesOnBottom: false,
includeSource: false,
},
function (pError, pSuccess) {
if (Boolean(pError)) {
window.output.innerHTML = pError;
}
},
);
}
function setTextAreaToWindowHeight() {
window.inputscript.style.height = "${height}px".replace(
"${height}",
window.innerHeight,
);
}
window.render.addEventListener("click", render, false);
window.loop.addEventListener(
"click",
function () {
window.inputscript.value +=
"\na loop d: condition {\n a =>> d: do stuff;\n};\n";
render();
},
false,
);
window.alt.addEventListener(
"click",
function () {
window.inputscript.value +=
"\na alt d: happyflow {\n # happy flow here\n\n ---: alternateflow; \n # alternate flow here\n};\n";
render();
},
false,
);
window.addEventListener("resize", setTextAreaToWindowHeight);
setTextAreaToWindowHeight();
window.version.innerHTML = "mscgenjs ${version}".replace(
"${version}",
mscgenjs.version,
);
render();
});