How to use the @finos/perspective.shared_worker 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 / examples / phosphor / src / index.js View on Github external
* This file is part of the Perspective library, distributed under the terms of
 * the Apache License 2.0.  The full license can be found in the LICENSE file.
 *
 */

import perspective from "@finos/perspective";
import {PerspectiveWorkspace, PerspectiveWidget} from "@finos/perspective-phosphor";
import {Widget} from "@phosphor/widgets";
import "@finos/perspective-phosphor/src/theme/material/index.less";

import "@finos/perspective-viewer-hypergrid";
import "@finos/perspective-viewer-d3fc";

import "./index.less";

const worker = perspective.shared_worker();
const req = fetch("./superstore.arrow");

window.addEventListener("load", async () => {
    const resp = await req;
    const buffer = await resp.arrayBuffer();
    const table = worker.table(buffer);

    const workspace = new PerspectiveWorkspace();

    const widget1 = new PerspectiveWidget("One", {
        "row-pivots": ["Sub-Category"],
        columns: ["Profit", "Sales"]
    });

    const widget2 = new PerspectiveWidget("Two", {
        plugin: "d3_x_bar",
github finos / perspective / packages / perspective-viewer / src / js / viewer / perspective_element.js View on Github external
_get_worker() {
        if (this._table) {
            return this._table._worker;
        }
        return perspective.shared_worker();
    }
}