Closed joey-carlisle4 closed 3 years ago
Hi @joey-carlisle4 Currently, there is no such implementation that allows the dice to roll programmatically. I can think of adding that. Any suggestion will be really helpful. Thanks. :)
What another dice package did was to have a ref to the component which exposed a roll function. Then I could trigger that function when needed
Hi @joey-carlisle4,
We allow passing ref to the component and you can then use refName.current.rollDice(value)
. The value here is optional if you pass it, it will roll to the value.
This may give you a typescript warning. But this will work. Will fix the type script issue when i get time.
Is there a way to trigger a roll with a function rather than a key/mouse event? I want to be able to trigger it programmatically instead of a user doing it.