Wait for loading of AccuratePosition script.

This commit is contained in:
Christian Neumann 2020-11-20 11:29:57 +01:00
parent de305ecab9
commit d7d7952111
2 changed files with 8 additions and 1 deletions

View file

@ -17,6 +17,14 @@ export class GeoLocationHandler extends UIElement {
constructor() { constructor() {
super(undefined); super(undefined);
this._hasLocation = State.state.currentGPSLocation.map((location) => location !== undefined); this._hasLocation = State.state.currentGPSLocation.map((location) => location !== undefined);
var self = this;
import("../../vendor/Leaflet.AccuratePosition.js").then(() => {
self.init();
})
}
public init() {
this.ListenTo(this._hasLocation); this.ListenTo(this._hasLocation);
this.ListenTo(this._isActive); this.ListenTo(this._isActive);
this.ListenTo(this._permission); this.ListenTo(this._permission);

View file

@ -65,7 +65,6 @@
<div id="leafletDiv"></div> <div id="leafletDiv"></div>
<script src="./index.ts"></script> <script src="./index.ts"></script>
<script src="./vendor/Leaflet.AccuratePosition.js"></script>
<script data-goatcounter="https://pietervdvn.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script> <script data-goatcounter="https://pietervdvn.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>