Skip to content

Commit

Permalink
Merge pull request #600 from finos/vocab_refactor
Browse files Browse the repository at this point in the history
Clean up API names
  • Loading branch information
texodus authored May 28, 2019
2 parents 737d2f4 + 9c578b6 commit 7b7d34e
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 218 deletions.
4 changes: 2 additions & 2 deletions examples/git_history/chained.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<script>
window.addEventListener('WebComponentsReady', async function() {
var elem = document.getElementById('view1');
var worker = perspective.worker(window.location.origin.replace('http', 'ws'));
let view = worker.open_view('data_source_one');
var client = perspective.websocket();
let view = client.open_view('data_source_one');
let arrow = await view.to_arrow();
elem.load(perspective.worker().table(arrow));
});
Expand Down
4 changes: 2 additions & 2 deletions examples/git_history/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<script>
window.addEventListener('WebComponentsReady', function() {
var elem = document.getElementById('view1');
var worker = perspective.worker(window.location.origin.replace('http', 'ws'));
elem.load(worker.open('data_source_one'));
var client = perspective.websocket();
elem.load(client.open_table('data_source_one'));
});
</script>

Expand Down
6 changes: 3 additions & 3 deletions examples/git_history/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

const {WebSocketHost, table} = require("@finos/perspective");
const {WebSocketServer, table} = require("@finos/perspective");
const exec = require("child_process").exec;

function execute(command, callback) {
Expand All @@ -17,7 +17,7 @@ function execute(command, callback) {
}

execute(`git log --date=iso --pretty=format:'"%h","%an","%aD","%s","%ae"'`, log => {
const host = new WebSocketHost({assets: [__dirname]});
const server = new WebSocketServer({assets: [__dirname]});
const tbl = table("Hash,Name,Date,Message,Email\n" + log);
host.host_view("data_source_one", tbl.view());
server.host_table("data_source_one", tbl);
});
13 changes: 5 additions & 8 deletions examples/remote/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,17 @@

<script>



window.addEventListener('WebComponentsReady', async function() {
var elem = document.getElementById('view1');
var client = perspective.worker(window.location.origin.replace('http', 'ws'));
var client = perspective.websocket();
var view = client.open_view('data_source_one');
var arrow = await view.to_arrow();
var tbl = elem.worker.table(arrow, {limit: 10000});
view.on_update(x => tbl.update(x), {mode: "row"});
elem.worker.initialize_profile_thread();
elem.load(arrow, {limit: 10000});
view.on_update(x => {
elem.update(x);
}, {mode: "row"});

elem.load(tbl);
});

</script>

</body>
Expand Down
4 changes: 2 additions & 2 deletions examples/remote/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

const {WebSocketHost, table, initialize_profile_thread} = require("@finos/perspective");
const {WebSocketServer, table, initialize_profile_thread} = require("@finos/perspective");

/******************************************************************************
*
Expand Down Expand Up @@ -55,7 +55,7 @@ async function newArrow() {
return arrow;
}

const host = new WebSocketHost({assets: [__dirname]});
const host = new WebSocketServer({assets: [__dirname]});

async function init() {
if (CACHE_INPUT) {
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
*
*/

const {WebSocketHost} = require("@finos/perspective");
new WebSocketHost({assets: [__dirname]});
const {WebSocketServer} = require("@finos/perspective");
new WebSocketServer({assets: [__dirname]});
50 changes: 0 additions & 50 deletions examples/simple/superstore-d3fc.html

This file was deleted.

2 changes: 1 addition & 1 deletion packages/perspective-bench/src/js/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function run_node_version(args, run_test) {
function new_host() {
return new Promise(
resolve =>
new perspective.WebSocketHost({
new perspective.WebSocketServer({
assets: ["build"],
port: 0,
on_start: function() {
Expand Down
4 changes: 2 additions & 2 deletions packages/perspective-cli/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

const {WebSocketHost, table} = require("@finos/perspective/build/perspective.node.js");
const {WebSocketServer, table} = require("@finos/perspective/build/perspective.node.js");
const {read_stdin, open_browser} = require("./utils.js");
const fs = require("fs");
const path = require("path");
Expand Down Expand Up @@ -70,7 +70,7 @@ async function host(filename, options) {
if (options.assets) {
files = [options.assets, ...files];
}
const server = new WebSocketHost({assets: files, port: options.port});
const server = new WebSocketServer({assets: files, port: options.port});
let file;
if (filename) {
file = fs.readFileSync(filename).toString();
Expand Down
4 changes: 2 additions & 2 deletions packages/perspective-viewer/test/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const cons = require("console");
const private_console = new cons.Console(process.stdout, process.stderr);
const cp = require("child_process");

const {WebSocketHost} = require("@finos/perspective");
const {WebSocketServer} = require("@finos/perspective");

const IS_LOCAL_PUPPETEER = fs.existsSync(path.join(__dirname, "..", "..", "..", "..", "node_modules", "puppeteer"));
const LOCAL_RESULTS_FILENAME = `results.${process.platform}.json`;
Expand All @@ -31,7 +31,7 @@ exports.with_server = function with_server({paths}, body) {
if (test_root === "") {
throw "ERROR";
}
server = new WebSocketHost({
server = new WebSocketServer({
assets: paths || [path.join(test_root, "build")],
port: 0,
on_start: () => {
Expand Down
69 changes: 10 additions & 59 deletions packages/perspective/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The main API module for Perspective.
* [.to_columns([options])](#module_perspective..view+to_columns) ⇒ <code>Promise.&lt;Array&gt;</code>
* [.to_json([options])](#module_perspective..view+to_json) ⇒ <code>Promise.&lt;Array&gt;</code>
* [.to_csv([options])](#module_perspective..view+to_csv) ⇒ <code>Promise.&lt;string&gt;</code>
* [.col_to_js_typed_array(column_name)](#module_perspective..view+col_to_js_typed_array) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.col_to_js_typed_array(column_name, options)](#module_perspective..view+col_to_js_typed_array) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.to_arrow([options])](#module_perspective..view+to_arrow) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.num_rows()](#module_perspective..view+num_rows) ⇒ <code>Promise.&lt;number&gt;</code>
* [.num_columns()](#module_perspective..view+num_columns) ⇒ <code>Promise.&lt;number&gt;</code>
Expand All @@ -39,10 +39,6 @@ The main API module for Perspective.
* [.add_computed(computed)](#module_perspective..table+add_computed)
* [.columns(computed)](#module_perspective..table+columns) ⇒ <code>Array.&lt;string&gt;</code>
* [.column_metadata()](#module_perspective..table+column_metadata) ⇒ <code>Array.&lt;object&gt;</code>
* [~WorkerHost](#module_perspective..WorkerHost)
* [new WorkerHost(perspective)](#new_module_perspective..WorkerHost_new)
* [.post(msg, transfer)](#module_perspective..WorkerHost+post)
* [.init(buffer)](#module_perspective..WorkerHost+init)


* * *
Expand All @@ -60,7 +56,7 @@ The main API module for Perspective.
* [.to_columns([options])](#module_perspective..view+to_columns) ⇒ <code>Promise.&lt;Array&gt;</code>
* [.to_json([options])](#module_perspective..view+to_json) ⇒ <code>Promise.&lt;Array&gt;</code>
* [.to_csv([options])](#module_perspective..view+to_csv) ⇒ <code>Promise.&lt;string&gt;</code>
* [.col_to_js_typed_array(column_name)](#module_perspective..view+col_to_js_typed_array) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.col_to_js_typed_array(column_name, options)](#module_perspective..view+col_to_js_typed_array) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.to_arrow([options])](#module_perspective..view+to_arrow) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
* [.num_rows()](#module_perspective..view+num_rows) ⇒ <code>Promise.&lt;number&gt;</code>
* [.num_columns()](#module_perspective..view+num_columns) ⇒ <code>Promise.&lt;number&gt;</code>
Expand Down Expand Up @@ -219,7 +215,7 @@ config object.

<a name="module_perspective..view+col_to_js_typed_array"></a>

#### view.col\_to\_js\_typed\_array(column_name) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
#### view.col\_to\_js\_typed\_array(column_name, options) ⇒ <code>Promise.&lt;TypedArray&gt;</code>
Serializes a view column into a TypedArray.

**Kind**: instance method of [<code>view</code>](#module_perspective..view)
Expand All @@ -233,6 +229,12 @@ integer/float type, the Promise returns undefined.
**Params**

- column_name <code>string</code> - The name of the column to serialize.
- options <code>Object</code> - An optional configuration object.
- .data_slice <code>\*</code> - A data slice object from which to serialize.
- .start_row <code>number</code> - The starting row index from which
to serialize.
- .end_row <code>number</code> - The ending row index from which
to serialize.


* * *
Expand All @@ -248,6 +250,7 @@ data from the view.
**Params**

- [options] <code>Object</code> - An optional configuration object.
- .data_slice <code>\*</code> - A data slice object from which to serialize.
- .start_row <code>number</code> - The starting row index from which
to serialize.
- .end_row <code>number</code> - The ending row index from which
Expand Down Expand Up @@ -616,55 +619,3 @@ If the column is computed, the `computed` property is an Object containing:

* * *

<a name="module_perspective..WorkerHost"></a>

### perspective~WorkerHost
**Kind**: inner class of [<code>perspective</code>](#module_perspective)

* [~WorkerHost](#module_perspective..WorkerHost)
* [new WorkerHost(perspective)](#new_module_perspective..WorkerHost_new)
* [.post(msg, transfer)](#module_perspective..WorkerHost+post)
* [.init(buffer)](#module_perspective..WorkerHost+init)


* * *

<a name="new_module_perspective..WorkerHost_new"></a>

#### new WorkerHost(perspective)
On initialization, listen for messages posted from the client and send it to `Host.process()`.

**Params**

- perspective - a reference to the Perspective module, allowing the `Host` to access Perspective methods.


* * *

<a name="module_perspective..WorkerHost+post"></a>

#### workerHost.post(msg, transfer)
Implements the `Host`'s `post()` method using the Web Worker `postMessage()` API.

**Kind**: instance method of [<code>WorkerHost</code>](#module_perspective..WorkerHost)
**Params**

- msg <code>Object</code> - a message to pass to the client
- transfer <code>\*</code> - a transferable object to pass to the client, if needed


* * *

<a name="module_perspective..WorkerHost+init"></a>

#### workerHost.init(buffer)
When initialized, replace Perspective's internal `__MODULE` variable with the WASM binary.

**Kind**: instance method of [<code>WorkerHost</code>](#module_perspective..WorkerHost)
**Params**

- buffer <code>ArrayBuffer</code> - an ArrayBuffer containing the Perspective WASM code


* * *

42 changes: 0 additions & 42 deletions packages/perspective/bench/html/delta_benchmark.html

This file was deleted.

Loading

0 comments on commit 7b7d34e

Please sign in to comment.