-
Notifications
You must be signed in to change notification settings - Fork 22
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
Monitors #12
Comments
hey @gsimone, |
Reopening! Pretty sure Gianmarco was already thinking of the new magic api he has in mind, but first things first! |
Hey @CptCompiler we had them working in the previous API, but weren't too happy about it. Monitors are special in that they have to be imperatively set by the user, original API was something like: const [monitor,setMonitor] = createMonitor(...)
useTweaks(monitor)
// your imperative code
setMonitor(4) Opinions? |
@dbismut proposes using a ref, which we feel is more react-like const ref = useRef(0)
useTweaks("Monitor", {
...otherTweaks,
...makeMonitor(ref, "MyMonitorName", ...settings))
}
// setting the ref value to update the monitor
useFrame(({ clock }) => { ref.current = Math.sin(clock.getElapsedTime()) }) |
Thanks for your fast replies, guys! Hmm... I think I would prefer refs as well. Sounds good. |
If you want you can give some feedback in PR #35 |
Yeah... thank you very much. Keep up the good work! 🎉 |
API for monitors, maybe a fn that hides constants or something
The text was updated successfully, but these errors were encountered: