Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get it working #25

Open
ChopsKingsland opened this issue Feb 18, 2021 · 0 comments
Open

Can't get it working #25

ChopsKingsland opened this issue Feb 18, 2021 · 0 comments

Comments

@ChopsKingsland
Copy link

Describe the bug
I am using the code:

gameControl.on('connect', function(gamepad) {
    gamepad.on('button0', console.log('up'));
});

and all it prints in the console is

[Info] Gamepad detected. (gamecontroller.min.js, line 1)
[Log] up (index.js, line 2)
[Error] TypeError: this.buttonActions[e].action is not a function. (In 'this.buttonActions[e].action()', 'this.buttonActions[e].action' is undefined)
	checkStatus (gamecontroller.min.js:1:2758)
	checkStatus (gamecontroller.min.js:1:5839)

To Reproduce
My code is:
index.html

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js"> <!--<![endif]-->
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="">
    </head>
    <body>
        <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
        <script src="gamecontroller.min.js"></script>
        <script src="index.js" async defer></script>
        <p id="gamepadInfo"></p>
    </body>
</html>

index.js

gameControl.on('connect', function(gamepad) {
    gamepad.on('button0', console.log('up'));
});

Expected behavior
Print 'up' when the A button is pressed

Desktop (please complete the following information):

  • OS: macOS Big Sur
  • Browser: Safari
  • Version: Safari 14.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant