-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (19 loc) · 821 Bytes
/
script.js
File metadata and controls
25 lines (19 loc) · 821 Bytes
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
// muTS note:
// This file is NOT a part of muTS.
// It's used to load AMDModules version of the code for demo page (index.html)
requirejs (["AMDModules/bin/Mu.js"], function (_mu) {
let Mu = _mu.default.prototype.constructor;
// Hook up events once everyting has loaded
let FileInputElement = document.getElementById ("fileInput");
document.getElementById ("parseFile").addEventListener ("click", () => {
if (FileInputElement.files.length < 1) {
console.log ("No file was selected");
return;
}
let reader = new FileReader();
reader.onload = () => {
console.log ("Result:", new Mu (new Uint8Array (reader.result)));
}
reader.readAsArrayBuffer (FileInputElement.files[0]);
});
});