Files
pezkuwi-subxt/substrate/bin/node/cli/browser-demo/index.html
T
Ashley bb44f8fc24 Add a browser-utils crate (#4394)
* Squash

* Fix keystore on wasm

* Update utils/browser/Cargo.toml

Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org>

* export console functions

* Use an Option<PathBuf> in keystore instead of cfg flags

* Add a KeystoreConfig

* Update libp2p

* Bump kvdb-web version

* Fix cli

* Upgrade versions

* Update wasm-bindgen stuff

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-01-07 16:30:04 +01:00

40 lines
1011 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Substrate node</title>
<link rel="shortcut icon" href="/favicon.png" />
<script type="module">
import { start_client, default as init } from './pkg/node_cli.js';
import ws from './ws.js';
function log(msg) {
document.getElementsByTagName('body')[0].innerHTML += msg + '\n';
}
async function start() {
log('Loading WASM');
await init('./pkg/node_cli_bg.wasm');
log('Successfully loaded WASM');
// Build our client.
log('Starting client');
let client = await start_client(ws());
log('Client started');
client.rpcSubscribe('{"method":"chain_subscribeNewHead","params":[],"id":1,"jsonrpc":"2.0"}',
(r) => log("New chain head: " + r));
setInterval(() => {
client
.rpcSend('{"method":"system_networkState","params":[],"id":1,"jsonrpc":"2.0"}')
.then((r) => log("Network state: " + r));
}, 20000);
}
start();
</script>
</head>
<body style="white-space: pre"></body>
</html>