Skip to content

Commit f64c2c7

Browse files
committed
refactor: use RegisterCommBusListener for example
1 parent 512fc29 commit f64c2c7

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

examples/gauge/Components/NavigraphLogin.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export class NavigraphLogin extends DisplayComponent<NavigraphLoginProps> {
1919

2020
private cancelSource = CancelToken.source()
2121

22-
private commBusListener: ViewListener.ViewListener
22+
private commBusListener: CommBusListener
2323

2424
private wasmInitialized = false
2525

2626
constructor(props: NavigraphLoginProps) {
2727
super(props)
2828

29-
this.commBusListener = RegisterViewListener("JS_LISTENER_COMM_BUS", () => {
30-
console.info("JS_LISTENER_COMM_BUS registered")
29+
this.commBusListener = RegisterCommBusListener(() => {
30+
console.info("CommBus listener registered")
3131
})
3232

3333
this.commBusListener.on("NAVIGRAPH_Heartbeat", () => {
@@ -137,8 +137,7 @@ export class NavigraphLogin extends DisplayComponent<NavigraphLoginProps> {
137137
const url = pkg.file.url
138138
// eslint-disable-next-line @typescript-eslint/no-floating-promises
139139
if (this.wasmInitialized) {
140-
this.commBusListener.call(
141-
"COMM_BUS_WASM_CALLBACK",
140+
this.commBusListener.callWasm(
142141
"NAVIGRAPH_DownloadNavdata",
143142
JSON.stringify({
144143
url,

examples/gauge/MyInstrument.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44

55
<link rel="stylesheet" href="MyInstrument.css" />
66
<script type="text/html" import-script="/JS/dataStorage.js"></script>
7-
<script
8-
type="text/html"
9-
import-script="/Pages/VCockpit/Instruments/Navigraph/NavdataInterfaceSample/MyInstrument.js"
10-
></script>
7+
<script type="text/html" import-script="/JS/Services/CommBus.js"></script>
8+
<script type="text/html"import-script="/Pages/VCockpit/Instruments/Navigraph/NavdataInterfaceSample/MyInstrument.js"></script>

0 commit comments

Comments
 (0)