aviation-chart 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nav-sdk.d.ts +7 -2
- package/dist/nav-sdk.esm.js +21 -1
- package/package.json +1 -1
package/dist/nav-sdk.d.ts
CHANGED
|
@@ -438,7 +438,9 @@ interface IMapSDK {
|
|
|
438
438
|
destroy(): void;
|
|
439
439
|
use(plugin: IPlugin): void;
|
|
440
440
|
getPlugin<T extends IPlugin>(name: string): T | undefined;
|
|
441
|
-
setPeriod(period: string
|
|
441
|
+
setPeriod(period: string, options?: {
|
|
442
|
+
validate?: boolean;
|
|
443
|
+
}): void;
|
|
442
444
|
getPeriod(): string | undefined;
|
|
443
445
|
generateCurrentPeriod(): Promise<string>;
|
|
444
446
|
showGraticule(): void;
|
|
@@ -1036,7 +1038,10 @@ declare class MapSDK implements IMapSDK {
|
|
|
1036
1038
|
lazyLoadingEnabled: boolean;
|
|
1037
1039
|
};
|
|
1038
1040
|
getErrorStats(): void;
|
|
1039
|
-
setPeriod(period: string
|
|
1041
|
+
setPeriod(period: string, options?: {
|
|
1042
|
+
validate?: boolean;
|
|
1043
|
+
}): void;
|
|
1044
|
+
private _applyPeriod;
|
|
1040
1045
|
getPeriod(): string | undefined;
|
|
1041
1046
|
generateCurrentPeriod(): Promise<string>;
|
|
1042
1047
|
search(params: SearchParams): Promise<SearchResultItem[]>;
|
package/dist/nav-sdk.esm.js
CHANGED
|
@@ -6607,12 +6607,32 @@ class MapSDK {
|
|
|
6607
6607
|
}
|
|
6608
6608
|
getErrorStats() {
|
|
6609
6609
|
}
|
|
6610
|
-
setPeriod(period) {
|
|
6610
|
+
setPeriod(period, options) {
|
|
6611
|
+
if (options?.validate) {
|
|
6612
|
+
this.getPeriods()
|
|
6613
|
+
.then((all) => {
|
|
6614
|
+
if (!all.includes(period)) {
|
|
6615
|
+
const err = new Error(`期数 ${period} 不存在,可用期数:${all.join(", ")}`);
|
|
6616
|
+
this.map?.fire("error", { error: err });
|
|
6617
|
+
return;
|
|
6618
|
+
}
|
|
6619
|
+
this._applyPeriod(period);
|
|
6620
|
+
})
|
|
6621
|
+
.catch((e) => (void 0));
|
|
6622
|
+
return;
|
|
6623
|
+
}
|
|
6624
|
+
this._applyPeriod(period);
|
|
6625
|
+
}
|
|
6626
|
+
_applyPeriod(period) {
|
|
6627
|
+
const from = this.getPeriod();
|
|
6611
6628
|
this.globalConfig.setPeriod(period);
|
|
6612
6629
|
const navdata = this.map?.getSource("navdata");
|
|
6613
6630
|
if (navdata?.setTiles) {
|
|
6614
6631
|
navdata.setTiles([navdataTilesUrl(this._chartApiUrl, period)]);
|
|
6615
6632
|
}
|
|
6633
|
+
if (from !== undefined && from !== period) {
|
|
6634
|
+
this.map?.fire("periodchange", { from, to: period });
|
|
6635
|
+
}
|
|
6616
6636
|
}
|
|
6617
6637
|
getPeriod() {
|
|
6618
6638
|
return this.globalConfig.getPeriod();
|