@@ -6,7 +6,7 @@ import "./InterfaceSample.css"
6
6
import {
7
7
DownloadProgressPhase ,
8
8
NavigraphEventType ,
9
- NavigraphNavdataInterface ,
9
+ NavigraphNavigationDataInterface ,
10
10
} from "@navigraph/msfs-navigation-data-interface"
11
11
import { Dropdown } from "./Dropdown"
12
12
@@ -16,7 +16,7 @@ interface InterfaceSampleProps extends ComponentProps {
16
16
17
17
export class InterfaceSample extends DisplayComponent < InterfaceSampleProps > {
18
18
private readonly textRef = FSComponent . createRef < HTMLDivElement > ( )
19
- private readonly navdataTextRef = FSComponent . createRef < HTMLDivElement > ( )
19
+ private readonly navigationDataTextRef = FSComponent . createRef < HTMLDivElement > ( )
20
20
private readonly loginButtonRef = FSComponent . createRef < HTMLButtonElement > ( )
21
21
private readonly qrCodeRef = FSComponent . createRef < HTMLImageElement > ( )
22
22
private readonly dropdownRef = FSComponent . createRef < Dropdown > ( )
@@ -26,24 +26,24 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
26
26
27
27
private cancelSource = CancelToken . source ( )
28
28
29
- private navdataInterface : NavigraphNavdataInterface
29
+ private navigationDataInterface : NavigraphNavigationDataInterface
30
30
31
31
constructor ( props : InterfaceSampleProps ) {
32
32
super ( props )
33
33
34
- this . navdataInterface = new NavigraphNavdataInterface ( )
34
+ this . navigationDataInterface = new NavigraphNavigationDataInterface ( )
35
35
36
- this . navdataInterface . onReady ( ( ) => {
37
- this . navdataInterface
36
+ this . navigationDataInterface . onReady ( ( ) => {
37
+ this . navigationDataInterface
38
38
. set_active_database ( "avionics_v2" )
39
39
. then ( ( ) => console . info ( "WASM set active database" ) )
40
40
. catch ( err => this . displayError ( String ( err ) ) )
41
41
} )
42
42
43
- this . navdataInterface . onEvent ( NavigraphEventType . DownloadProgress , data => {
43
+ this . navigationDataInterface . onEvent ( NavigraphEventType . DownloadProgress , data => {
44
44
switch ( data . phase ) {
45
45
case DownloadProgressPhase . Downloading :
46
- this . displayMessage ( "Downloading navdata ..." )
46
+ this . displayMessage ( "Downloading navigation data ..." )
47
47
break
48
48
case DownloadProgressPhase . Cleaning :
49
49
if ( ! data . deleted ) return
@@ -67,7 +67,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
67
67
< div class = "vertical" >
68
68
< div ref = { this . textRef } > Loading</ div >
69
69
< div ref = { this . loginButtonRef } class = "button" />
70
- < div ref = { this . navdataTextRef } />
70
+ < div ref = { this . navigationDataTextRef } />
71
71
< img ref = { this . qrCodeRef } class = "qr-code" />
72
72
</ div >
73
73
< div class = "vertical" >
@@ -97,7 +97,7 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
97
97
98
98
this . executeButtonRef . instance . addEventListener ( "click" , ( ) => {
99
99
console . time ( "query" )
100
- this . navdataInterface
100
+ this . navigationDataInterface
101
101
. get_airport ( this . inputRef . instance . value )
102
102
. then ( airport => {
103
103
console . info ( airport )
@@ -157,20 +157,20 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
157
157
158
158
private async handleDownloadClick ( ) {
159
159
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" )
161
161
162
162
const format = this . dropdownRef . instance . getNavigationDataFormat ( )
163
163
if ( ! format ) throw new Error ( "Unable to fetch package: No navigation data format has been selected" )
164
164
165
165
// Get default package for client
166
166
const pkg = await packages . getPackage ( format )
167
167
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" )
171
171
172
172
// 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 )
174
174
console . info ( "WASM set active database" )
175
175
} catch ( err ) {
176
176
if ( err instanceof Error ) this . displayError ( err . message )
@@ -179,12 +179,12 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
179
179
}
180
180
181
181
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"
184
184
}
185
185
186
186
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"
189
189
}
190
190
}
0 commit comments