Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeAll(() => {
if (test_root === "") {
throw "ERROR";
}
server = new WebSocketServer({
assets: paths || [path.join(test_root, "dist", "umd")],
port: 0,
on_start: () => {
__PORT__ = server._server.address().port;
}
});
});
await populate_cache();
const tbl = perspective.table(newRows(TABLE_SIZE), {limit: TABLE_SIZE});
host.host_view("data_source_one", tbl.view());
(function postRow() {
const entry = __CACHE__[Math.floor(Math.random() * __CACHE__.length)];
tbl.update(entry);
setTimeout(postRow, TICK_RATE);
})();
}
/*******************************************************************************
*
* Main
*/
const host = new perspective.WebSocketServer({assets: [__dirname]});
if (CACHE_INPUT) {
init_cached();
} else {
init_dynamic();
}
async function host(filename, options) {
let files = [path.join(__dirname, "html")];
if (options.assets) {
files = [options.assets, ...files];
}
const server = new WebSocketServer({assets: files, port: options.port});
let file;
if (filename) {
file = table(fs.readFileSync(filename).toString());
} else {
file = await read_stdin();
}
server.host_table("data_source_one", file);
if (options.open) {
open_browser(options.port);
}
}