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

Request - Button hold, continually trigger action #873

Closed
kevincannon opened this issue Jul 22, 2015 · 10 comments
Closed

Request - Button hold, continually trigger action #873

kevincannon opened this issue Jul 22, 2015 · 10 comments

Comments

@kevincannon
Copy link

I've a small feature request. In the Button object, there's a hold trigger. However, it only triggers after 500ms, and never again. Often press & hold is something where you need to repeatedly do the action like a keyboard. It woud be nice to have a repeat option built in.

http://johnny-five.io/api/button/

Something like this:

rightButton   = new five.Button({
pin:3,
isPullup: true,
holdtime: 200,
holdrepeat: true
});

button.on("hold", function() {
    console.log("hold");
});

Then you would get this as an output

hold
hold
hold

It would be neat if it was built in!

@rwaldron
Copy link
Owner

I like it and I think this might even be preferable as the default behavior? I won't be able to release b/c we're "frozen" until after Nodebots Day (this Saturday)—is that ok?

@Resseguie
Copy link
Collaborator

I like it too.

@kevincannon
Copy link
Author

No rush at all, i've made a workaround for my needs for now, but built in would be even better :)

@rwaldron
Copy link
Owner

@kevincannon thanks for your patience!

@dtex
Copy link
Collaborator

dtex commented Jul 24, 2015

Should this be a different event? Currently the hold event represents a state change. Also, we may want different behavior on that initial state change then we would want on the repeated firings of the event.

@dtex
Copy link
Collaborator

dtex commented Jul 24, 2015

Never mind, I didn't really think that through. Hold is not a state change.

@rwaldron
Copy link
Owner

Also, we may want different behavior on that initial state change then we would want on the repeated firings of the event.

button.once("hold", ...)?

@Resseguie
Copy link
Collaborator

I like that @rwaldron

@kevincannon
Copy link
Author

Wow guys - just checked that out, that's amazing. Thanks so much! :)

@rwaldron
Copy link
Owner

Thank you for filing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants