Atlas - joystick-pre.js
Home / ext / SDL2 / test / emscripten Lines: 1 | Size: 749 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1Module['arguments'] = ['0']; 2//Gamepads don't appear until a button is pressed and the joystick/gamepad tests expect one to be connected 3Module['preRun'].push(function() 4{ 5 Module['print']("Waiting for gamepad..."); 6 Module['addRunDependency']("gamepad"); 7 window.addEventListener('gamepadconnected', function() 8 { 9 //OK, got one 10 Module['removeRunDependency']("gamepad"); 11 }, false); 12 13 //chrome 14 if(!!navigator.webkitGetGamepads) 15 { 16 var timeout = function() 17 { 18 if(navigator.webkitGetGamepads()[0] !== undefined) 19 Module['removeRunDependency']("gamepad"); 20 else 21 setTimeout(timeout, 100); 22 } 23 setTimeout(timeout, 100); 24 } 25}); 26[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.