clustergrammer-gl icon indicating copy to clipboard operation
clustergrammer-gl copied to clipboard

Make Observable HQ Improvements

Open cornhundred opened this issue 4 years ago • 0 comments

We received the following recommendations from the Observable Discourse page (https://talk.observablehq.com/t/help-with-reactive-updates-from-custom-library/2907):

  • Clustergrammer-GL requires that the container be inserted into the DOM before initializing, and requires a globally-unique identifier for that container. If it didn’t have these requirements, it would be easier to initialize in Observable (where cells normally run with detached DOM elements, and only insert them into the DOM by returning a value at the end).

  • The most natural way to make Clustergrammer-GL reactive would be for it to emit custom events when things change. I did that manually by intercepting when some internal parameters are set, and by listening to browser native events (mousemove). But if Clustergrammer-GL emitted these events itself, it’d be more straightforward to expose those as reactive values in Observable using Generators.observe.

  • It’s best to avoid bundle.run in notebooks, as it isn’t very reliable. I re-attached the generated bundle to your notebook, but if you published an AMD- or UMD-compatible bundle to npm, then folks could require("clustergrammer-gl") and it would work out of the box.

cornhundred avatar Apr 18 '20 17:04 cornhundred