You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Idea came from a conversation with @hydrosquall - what if a Datasette plugin could say "I'd like the JSON for a page to be included in a variable on the HTML page"?
datasette-cluster-map already needs this - the first thing it does when the page loads is fetch() a JSON representation of that same data.
This idea fits with my overall goals to unify the JSON and HTML context too.
Then a function could be provided which extracts and parses that data:
vardata=awaitdatasette.jsonData();
Why an await? Because then I could have it work the exact same way if the data is NOT available on the page - it could trigger a fetch() call for the same stuff. So loading it on the page becomes an optional performance optimization.
If the table on the page were generated from the inlined JSON, the weight
of that initial load wouldn’t be different, in exchange for the overhead
client side element generation JS. The bigger problem though would be that
the client side JS probably wouldn’t be able to directly reuse the existing
plugins that generate custom table HTML.
Anyways the main benefit I had in mind was to avoid the situation where
multiple plugins were refetching the same data before either could put
something into browser cache, eg cluster map and Vega. But if someone is
only loading 1 plugin, the initial overhead may not pay off.
Idea came from a conversation with @hydrosquall - what if a Datasette plugin could say "I'd like the JSON for a page to be included in a variable on the HTML page"?
datasette-cluster-map
already needs this - the first thing it does when the page loads isfetch()
a JSON representation of that same data.This idea fits with my overall goals to unify the JSON and HTML context too.
Refs:
The text was updated successfully, but these errors were encountered: