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