How to use the @finos/perspective.override function in @finos/perspective

To help you get started, we’ve selected a few @finos/perspective examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github finos / perspective / packages / perspective-jupyterlab / src / ts / widget.ts View on Github external
* the Apache License 2.0.  The full license can be found in the LICENSE file.
 *
 */
import {Message} from "@phosphor/messaging";
import {DOMWidgetView} from "@jupyter-widgets/base";

import {PerspectiveViewerOptions} from "@finos/perspective-viewer";
import {PerspectiveWidget, PerspectiveWidgetOptions} from "@finos/perspective-phosphor";

import perspective from "@finos/perspective";

import * as wasm from "@finos/perspective/dist/umd/psp.async.wasm";
import * as worker from "!!file-worker-loader?inline=true!@finos/perspective/dist/umd/perspective.wasm.worker.js";

if (perspective) {
    perspective.override({wasm, worker});
} else {
    console.warn("Perspective was undefined in jlab - wasm load errors may occur");
}

export type PerspectiveJupyterWidgetOptions = {
    view: DOMWidgetView;
};

/**
 * PerspectiveJupyterWidget is the ipywidgets front-end for the Perspective Jupyterlab plugin.
 */
export class PerspectiveJupyterWidget extends PerspectiveWidget {
    constructor(name = "Perspective", options: PerspectiveViewerOptions & PerspectiveJupyterWidgetOptions & PerspectiveWidgetOptions) {
        const view = options.view;
        delete options.view;
        super(name, options);