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