-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.js
34 lines (29 loc) · 936 Bytes
/
debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* This module is used for manual experiments and
* demonstration of the JS->Elm interaction.
*/
const { setupApps } = require("./wiring/Apps");
const { expandApp } = setupApps({ kbPath: ".demo/data/example_kb.csv" });
// Debug on expand App
const app = expandApp;
// Setup subscriptions.
app.ports.toExtensionInfo.subscribe(function (msg) {
// Define message handler.
console.debug("INFO: got from port", msg);
});
app.ports.toExtensionError.subscribe(function (msg) {
// Define message handler.
console.error("ERR: got from port", msg);
});
app.ports.toExtensionContent.subscribe(function (msg) {
// Define message handler.
console.info("CONTENT: got from port ->", msg);
});
// Send message.
console.log("Sending to Elm...");
app.ports.fromExtension.send("Ping!");
app.ports.fromExtensionExpand.send("@@hl");
// Output:
// > Sending to Elm...
// > INFO: got from port Pong!
// > CONTENT: got from port -> hello