// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ // ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ // ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ // ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ // ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ // ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ // ┃ Copyright (c) 2017, the Perspective Authors. ┃ // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ // ┃ This file is part of the Perspective library, distributed under the terms ┃ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ import perspective from "@perspective-dev/client"; import perspective_viewer from "@perspective-dev/viewer"; import "@perspective-dev/viewer-datagrid"; import "@perspective-dev/viewer-charts"; import "@perspective-dev/viewer/dist/css/pro-dark.css"; import "./index.css"; import SERVER_WASM from "@perspective-dev/server/dist/wasm/perspective-server.wasm"; import CLIENT_WASM from "@perspective-dev/viewer/dist/wasm/perspective-viewer.wasm"; await Promise.all([ perspective.init_server(fetch(SERVER_WASM)), perspective_viewer.init_client(fetch(CLIENT_WASM)), ]); const viewer = document.createElement("perspective-viewer"); document.body.append(viewer); // Create two perspective interfaces, one remotely via WebSocket, // and one local via WebWorker. const url = `${window.location.origin.replace("http", "ws")}/subscribe`; const websocket = await perspective.websocket(url); // Open a `Table` that is hosted on the server. All instructions // will be proxied to the server `Table` - no calculations are // done on the client. const remote_table = await websocket.open_table("securities"); // Create a `table` from this, owned by the local WebWorker. // Data is transferred from `view` to the local WebWorker, both // the current state and all future updates, as Arrows. // const local_table = await worker.table(view, { limit: 10000 }); // Load this in the ``. viewer.load(remote_table);