Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input host on web test #56

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ Get a file from local storage:

```console
npx blockset-js hsdfs1zs8fnf810v8f9k6pjdkz7b4y95sembmswac5sjt out.txt
```
```

From a web browser: https://blockset-js.pages.dev/
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<link rel="stylesheet" href="main.css">
</head>
<body>
Hash: <input id="input"/><button id="download">Download</button>
Hash: <input id="input-hash" size="50" value="awt9x8564999k276wap2e5b7n10575ffy946kencva4ve"/>
<br>
Host: <input id="input-host" size="50" value="410f5a49.blockset-js-test.pages.dev"/>
<br>
<button id="download">Download</button>
<pre id="log"></pre>
<pre id="output"></pre>
</body>
Expand Down
6 changes: 4 additions & 2 deletions web-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ const { get, fetchRead } = getModule
// @ts-ignore
document.getElementById('download').addEventListener('click', () => {
// @ts-ignore
const hash = document.getElementById('input').value
const hash = document.getElementById('input-hash').value
// @ts-ignore
const host = document.getElementById('input-host').value
let buffer = new Uint8Array()
const fRead = fetchRead('410f5a49.blockset-js-test.pages.dev')
const fRead = fetchRead(host)
/** @type {(address: Address) => Promise<Uint8Array>} */
const read = address => {
// @ts-ignore
Expand Down