Skip to content

Commit 03f7c17

Browse files
committed
doing something with the SSB clienr
1 parent 2ec6c86 commit 03f7c17

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

site/page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
55
</head>
66
<body>
7-
<p>RPC conection with the plugin, see the console for some output.</p>
8-
7+
<p>RPC connection with SSB via native messaging.</p>
8+
<div id="output"></div>
99
<script src="page-script.js"></script>
1010
</body>
1111
</html>

src/page-script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ const client = MRPC(function (err, manifest) {
5757
console.log('adding client to window')
5858
window.client = client
5959
window.pull = pull
60+
61+
const outElem = document.getElementById('output')
62+
63+
const opts = {
64+
limit: 100,
65+
reverse: true
66+
}
67+
68+
pull(
69+
client.query.read(opts),
70+
pull.drain(msg => {
71+
outElem.innerHTML += `<pre>${JSON.stringify(msg, null, 2)}</pre>`
72+
outElem.innerHTML += '<hr/>'
73+
})
74+
)
75+
6076
})()
6177

6278
const onClose = () => {

0 commit comments

Comments
 (0)