User input events
Closed this issue ยท 4 comments
Is there any way to detect user clicks? Do you plan to add this in the future?
Hey @KonradLinkowski, great question.
As soon as the Checkbox grid is created, you can add your own event listeners to the markup. The markup doesn't change once the grid is created, so the events won't get altered or removed.
As an example, the "logo" in the top left corner of the docs page is clickable. Here's the code that adds the event listener.
I feel like this works well enough that I'm not planning on adding anything else for events. But let me know if you run into a use-case where a plain addEventListener
won't work.
This works fine for full grid clicking, but it detecting which checkbox was clicked isn't so simple (perhaps I'm wrong).
I was thinking more of an event which carry an information about position of clicked checkbox and it's state.
Ahhh, I see. I totally get how that could be useful.
This would make a good plugin. Many of the example features (like marquee
, and print
) are plugins that I've included in the main library.
My current thinking is that new features like this should be built as an external plugin first, and then, if it proves useful, I'd consider pulling it into the main library (this is described here in the README).
If you have the time or interest to take a pass at this, I'll link to your plugin from this issue and here in the docs. It wouldn't even need to be packaged on NPM or even in a repo... I'd be cool with linking to a gist too, as long as it was functional).
If not, that's cool. I'll leave this issue open, and tag it with plugin request
so anybody who's interested can give it a shot. ๐
Thanks for the help @KonradLinkowski. The feature is now merged and published in version 1.2.0. ๐