I tried this and it worked for me:
import "dart:html"; main(){ window.animationFrame.then(runAnimation); } runAnimation(timestamp){ var gamepads = window.navigator.getGamepads(); for (var pad in gamepads) { if(pad != null){ querySelector("#buttons").setInnerHtml("${pad.buttons.join(" ")}</br>${pad.axes.join(" ")}"); } } window.requestAnimationFrame(runAnimation); }
user3357834
source share