Reusable and Reactive Visualization Widgets or Components | Declan Naughton | Observable
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
•ojs
Comments (4)
John Alexis Guerra Gómez
Jun 4, 2025
I think you need that extra showValue for when the widget is updated by another widget, for example for Inputs.bind
Declan Naughton
Jun 4, 2025
It seems like Inputs.bind dispatches an event:
https://github.com/observablehq/inputs/blob/7ae53c757080b99ca3b498653cf2bc49bf8125a1/src/bind.js#L7
It's very, very nity anyways
John Alexis Guerra Gómez
Jun 5, 2025
Yes, and then the reactive widget captures the event and calls setValue, which then needs to call showValue
Declan Naughton
Jun 5, 2025
But there is already a listener that triggers showValue: target.addEventListener("input", showValue) which is why I think the call is redundant. When I'm using the pattern I can experiment if showValue isn't very cheap (it usually is)
Reply
Add comment
Subscribe to notifications
Observable
Sign in
Declan Naughton
0
Reply
Add comment
Subscribe to notifications
0
Reusable and Reactive Visualization Widgets or Components | Declan Naughton | Observable