forked from finos/perspective
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (27 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/******************************************************************************
*
* Copyright (c) 2018, the Perspective Authors.
*
* 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 "@finos/perspective-viewer";
import "@finos/perspective-viewer-datagrid";
import "@finos/perspective-viewer-d3fc";
import "@finos/perspective-viewer/dist/umd/material.css";
import "./index.css";
const worker = perspective.shared_worker();
// superstore.arrow located in examples/simple/ and it's configured by
// 'devServer' in 'webpack.config.js'
const req = fetch("./superstore.arrow");
window.addEventListener("load", async () => {
const viewer = document.createElement("perspective-viewer");
document.body.append(viewer);
const resp = await req;
const buffer = await resp.arrayBuffer();
const table = worker.table(buffer);
viewer.load(table);
window.viewer = viewer;
});