xref: /freebsd/sys/contrib/libsodium/test/default/pre.js.inc (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1try {
2    this['Module'] = Module;
3    Module.test;
4} catch(e) {
5    this['Module'] = Module = {};
6}
7if (typeof process === 'object') {
8    if (typeof(FS) === 'object') {
9        Module['preRun'] = Module['preRun'] || [];
10        Module['preRun'].push(function() {
11            FS.init();
12            FS.mkdir('/test-data');
13            FS.mount(NODEFS,  { root: '.' }, '/test-data');
14        });
15    }
16} else {
17    Module['print'] = function(x) {
18        var event = new Event('test-output');
19        event.data = x;
20        window.dispatchEvent(event);
21    };
22}
23