From ab9bc5fd19db07be0d560b011112438b195593dc Mon Sep 17 00:00:00 2001 From: Cameron Yick Date: Thu, 23 Mar 2023 22:42:51 -0400 Subject: [PATCH] test: register table plugin using a test API --- datasette/static/datasette-manager.js | 5 ++++- datasette/static/table.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/datasette/static/datasette-manager.js b/datasette/static/datasette-manager.js index 643d55d8..9a83acbb 100644 --- a/datasette/static/datasette-manager.js +++ b/datasette/static/datasette-manager.js @@ -21,6 +21,8 @@ const datasetteManager = { // Does pluginMetadata need to be serializable, or can we let it be stateful / have functions? // Should we notify plugins that have dependencies // when all dependencies were fulfilled? (leaflet, codemirror, etc) + // https://github.com/simonw/datasette-leaflet -> this way + // multiple plugins can all request the same copy of leaflet. plugins: new Map(), registerPlugin: (name, pluginMetadata) => { if (datasetteManager.plugins.get(name)) { @@ -29,6 +31,8 @@ const datasetteManager = { datasetteManager.plugins.set(name, pluginMetadata); }, + /** State helpers */ + // https://github.com/simonw/datasette/issues/1144 // Datasette "core" -> Methods/APIs that are so core, we don't store them as a plugin /** Selectors for significant DOM elements. Store identifier rather than addresses rather than immediate references in case they haven't loaded yet */ @@ -43,7 +47,6 @@ const datasetteManager = { }; - /** * Fire AFTER the document has been parsed * Initialization... TODO how to make sure this exists BEFORE datasette manager is loaded? */ diff --git a/datasette/static/table.js b/datasette/static/table.js index 51e901a5..7c86a3b7 100644 --- a/datasette/static/table.js +++ b/datasette/static/table.js @@ -272,3 +272,14 @@ var DROPDOWN_ICON_SVG = ` console.log('hello') }); + +});