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

Name of gamepad and return obj on disconnect event #28

Open
dalter opened this issue Mar 4, 2021 · 2 comments
Open

Name of gamepad and return obj on disconnect event #28

dalter opened this issue Mar 4, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@dalter
Copy link

dalter commented Mar 4, 2021

Hi, In future pls add gamepad name variable
for example: I added in init: function
name: t.id,
And on disconnected event i return obj this.onDisconnect(e)
In some cases, it is needed for notifications, which gamepad was connected or disconnected
thank!

@alvaromontoro alvaromontoro added the enhancement New feature or request label Mar 4, 2021
@alvaromontoro
Copy link
Owner

Thanks for suggesting this; it is a nice-to-have enhancement.

Maybe I can look at it during the weekend with the other bug.

@alvaromontoro
Copy link
Owner

Maybe I misunderstood the request, but the plugin is already doing this: when a controller is connected, the gamepad object is passed as a parameter (the id/name will be in the id property); and on disconnect, the parameter is the id of the disconnected gamepad (instead of the whole object). For example:

gameControl.on('connect', function(gp) {
              // gp is the gamepad, the id is gp.id
              addSection(gp.id);
            })
            .on('disconnect', function(id) {
              // id of the disconnected gamepad
              removeSection(id);
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants