Skip to content

Commit 035900f

Browse files
committed
fix: use correct imports in example
1 parent 44e3081 commit 035900f

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

examples/gauge/Components/InterfaceSample.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "./InterfaceSample.css"
66
import {
77
DownloadProgressPhase,
88
NavigraphEventType,
9-
NavigraphNavdataInterface,
9+
NavigraphNavigationDataInterface,
1010
} from "@navigraph/msfs-navigation-data-interface"
1111
import { Dropdown } from "./Dropdown"
1212

@@ -16,7 +16,7 @@ interface InterfaceSampleProps extends ComponentProps {
1616

1717
export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
1818
private readonly textRef = FSComponent.createRef<HTMLDivElement>()
19-
private readonly navdataTextRef = FSComponent.createRef<HTMLDivElement>()
19+
private readonly navigationDataTextRef = FSComponent.createRef<HTMLDivElement>()
2020
private readonly loginButtonRef = FSComponent.createRef<HTMLButtonElement>()
2121
private readonly qrCodeRef = FSComponent.createRef<HTMLImageElement>()
2222
private readonly dropdownRef = FSComponent.createRef<Dropdown>()
@@ -26,24 +26,24 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
2626

2727
private cancelSource = CancelToken.source()
2828

29-
private navdataInterface: NavigraphNavdataInterface
29+
private navigationDataInterface: NavigraphNavigationDataInterface
3030

3131
constructor(props: InterfaceSampleProps) {
3232
super(props)
3333

34-
this.navdataInterface = new NavigraphNavdataInterface()
34+
this.navigationDataInterface = new NavigraphNavigationDataInterface()
3535

36-
this.navdataInterface.onReady(() => {
37-
this.navdataInterface
36+
this.navigationDataInterface.onReady(() => {
37+
this.navigationDataInterface
3838
.set_active_database("avionics_v2")
3939
.then(() => console.info("WASM set active database"))
4040
.catch(err => this.displayError(String(err)))
4141
})
4242

43-
this.navdataInterface.onEvent(NavigraphEventType.DownloadProgress, data => {
43+
this.navigationDataInterface.onEvent(NavigraphEventType.DownloadProgress, data => {
4444
switch (data.phase) {
4545
case DownloadProgressPhase.Downloading:
46-
this.displayMessage("Downloading navdata...")
46+
this.displayMessage("Downloading navigation data...")
4747
break
4848
case DownloadProgressPhase.Cleaning:
4949
if (!data.deleted) return
@@ -67,7 +67,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
6767
<div class="vertical">
6868
<div ref={this.textRef}>Loading</div>
6969
<div ref={this.loginButtonRef} class="button" />
70-
<div ref={this.navdataTextRef} />
70+
<div ref={this.navigationDataTextRef} />
7171
<img ref={this.qrCodeRef} class="qr-code" />
7272
</div>
7373
<div class="vertical">
@@ -97,7 +97,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
9797

9898
this.executeButtonRef.instance.addEventListener("click", () => {
9999
console.time("query")
100-
this.navdataInterface
100+
this.navigationDataInterface
101101
.get_airport(this.inputRef.instance.value)
102102
.then(airport => {
103103
console.info(airport)
@@ -157,20 +157,20 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
157157

158158
private async handleDownloadClick() {
159159
try {
160-
if (!this.navdataInterface.getIsInitialized()) throw new Error("Navdata interface not initialized")
160+
if (!this.navigationDataInterface.getIsInitialized()) throw new Error("Navigation data interface not initialized")
161161

162162
const format = this.dropdownRef.instance.getNavigationDataFormat()
163163
if (!format) throw new Error("Unable to fetch package: No navigation data format has been selected")
164164

165165
// Get default package for client
166166
const pkg = await packages.getPackage(format)
167167

168-
// Download navdata to work dir
169-
await this.navdataInterface.download_navdata(pkg.file.url, pkg.format)
170-
this.displayMessage("Navdata downloaded")
168+
// Download navigation data to work dir
169+
await this.navigationDataInterface.download_navigation_data(pkg.file.url, pkg.format)
170+
this.displayMessage("Navigation data downloaded")
171171

172172
// Set active database to recently downloaded package
173-
await this.navdataInterface.set_active_database(pkg.format)
173+
await this.navigationDataInterface.set_active_database(pkg.format)
174174
console.info("WASM set active database")
175175
} catch (err) {
176176
if (err instanceof Error) this.displayError(err.message)
@@ -179,12 +179,12 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
179179
}
180180

181181
private displayMessage(message: string) {
182-
this.navdataTextRef.instance.textContent = message
183-
this.navdataTextRef.instance.style.color = "white"
182+
this.navigationDataTextRef.instance.textContent = message
183+
this.navigationDataTextRef.instance.style.color = "white"
184184
}
185185

186186
private displayError(error: string) {
187-
this.navdataTextRef.instance.textContent = error
188-
this.navdataTextRef.instance.style.color = "red"
187+
this.navigationDataTextRef.instance.textContent = error
188+
this.navigationDataTextRef.instance.style.color = "red"
189189
}
190190
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)