Skip to content
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

Add docs for <perspective-viewer-plugin> #1538

Merged
merged 2 commits into from
Sep 13, 2021
Merged

Add docs for <perspective-viewer-plugin> #1538

merged 2 commits into from
Sep 13, 2021

Conversation

texodus
Copy link
Member

@texodus texodus commented Sep 12, 2021

  • Adds IPerspectiveViewerPlugin interface for TypeScript which described the new plugin API, as well as accompanying typedoc.
  • Registers <perspective-viewer-plugin> globally. This was previously named "perspective-viewer-debug" and was only registered when no other plugins were available, but it is simple enough to make a good default implementation for a simple plugin to build on top of. So in addition to implementing IPerspectiveViewerPlugin , or if you're using JavaScript, you can extend the class returned from customElements.get("perspective-viewer-plugin") and override only draw() and get name().
    const BasePlugin = customElements.get("perspective-viewer-plugin");
    class MyPlugin extends BasePlugin {
        get name() {
            return "My Plugin";
        }
        async draw(view) {
            const count = await view.num_rows();
            this.innerHTML = `View has ${count} rows`;
        }
    }
    
    customElements.define("my-plugin", MyPlugin);
    const Viewer = customElements.get("perspective-viewer");
    Viewer.registerPlugin("my-plugin");
  • Fixes perspective-config-update and perspective-plugin-update events for <perspective-viewer> and adds tests.

@texodus texodus added the documentation Improvements/bugs/changes to documentation label Sep 12, 2021
@texodus texodus marked this pull request as ready for review September 13, 2021 00:31
@texodus texodus merged commit c49aa08 into master Sep 13, 2021
@texodus texodus deleted the docs-plugin branch September 13, 2021 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements/bugs/changes to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant