made scripts ladaing async

This commit is contained in:
e7d 2016-11-11 10:01:01 +01:00
parent 713ea19641
commit 76576ef297
3 changed files with 5 additions and 5 deletions

View File

@ -192,6 +192,8 @@ function updateVisualStatus() {
return; return;
} }
requestAnimationFrame(updateVisualStatus);
var button; var button;
var $button; var $button;
for (var buttonIndex = 0; buttonIndex < activeGamepad.buttons.length; buttonIndex++) { for (var buttonIndex = 0; buttonIndex < activeGamepad.buttons.length; buttonIndex++) {
@ -234,8 +236,6 @@ function updateVisualStatus() {
updateAxis($axis); updateAxis($axis);
} }
} }
requestAnimationFrame(updateVisualStatus);
} }
function changeGamepadColor(gamepadColor) { function changeGamepadColor(gamepadColor) {
@ -291,7 +291,7 @@ function changeZoom(zoomLevel) {
activeGamepadZoomLevel = zoomLevel; activeGamepadZoomLevel = zoomLevel;
} }
// hack: fix floatjs float issues // hack: fix js float issues
activeGamepadZoomLevel = +activeGamepadZoomLevel.toFixed(1); activeGamepadZoomLevel = +activeGamepadZoomLevel.toFixed(1);
$gamepad.css('transform', 'translate(-50%, -50%) scale(' + activeGamepadZoomLevel + ', ' + activeGamepadZoomLevel + ')'); $gamepad.css('transform', 'translate(-50%, -50%) scale(' + activeGamepadZoomLevel + ', ' + activeGamepadZoomLevel + ')');

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="templates/ds4/template.css"> <link rel="stylesheet" href="templates/ds4/template.css">
<script src="templates/ds4/template.js"></script> <script async src="templates/ds4/template.js"></script>
<div class="triggers"> <div class="triggers">
<span class="trigger left" data-button="6" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span> <span class="trigger left" data-button="6" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span>
<span class="trigger right" data-button="7" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span> <span class="trigger right" data-button="7" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span>

View File

@ -1,5 +1,5 @@
<link rel="stylesheet" href="templates/xbox-one/template.css"> <link rel="stylesheet" href="templates/xbox-one/template.css">
<script src="templates/xbox-one/template.js"></script> <script async src="templates/xbox-one/template.js"></script>
<div class="triggers"> <div class="triggers">
<span class="trigger left" data-button="6" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span> <span class="trigger left" data-button="6" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span>
<span class="trigger right" data-button="7" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span> <span class="trigger right" data-button="7" style="-webkit-clip-path: inset(100% 0px 0px 0pc);"></span>