mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPROVEMENT: Map API loaded event
This commit is contained in:
parent
8e55640a12
commit
01d1edfaab
@ -7,7 +7,7 @@ import '../../scss/_components/_ui.map.scss';
|
||||
|
||||
import CONSTS from 'js/_consts';
|
||||
|
||||
const MapAPI = (($) => {
|
||||
const MapAPI = ($ => {
|
||||
// Constants
|
||||
const NAME = 'jsMapAPI';
|
||||
const DATA_KEY = NAME;
|
||||
@ -38,7 +38,7 @@ const MapAPI = (($) => {
|
||||
Drv.init($el, config);
|
||||
ui.drv = Drv;
|
||||
|
||||
$el.on(Events.MAPAPILOADED, (e) => {
|
||||
$el.on(Events.MAPAPILOADED, e => {
|
||||
ui.map = Drv.getMap();
|
||||
|
||||
if (config['geojson']) {
|
||||
@ -47,7 +47,7 @@ const MapAPI = (($) => {
|
||||
} else if (config['address']) {
|
||||
console.log(config['address']);
|
||||
console.log(`${NAME}: setting up address marker`);
|
||||
Drv.geocode(config['address'], (result) => {
|
||||
Drv.geocode(config['address'], result => {
|
||||
console.log(result);
|
||||
});
|
||||
} else if (config['lat'] && config['lng']) {
|
||||
@ -60,13 +60,12 @@ const MapAPI = (($) => {
|
||||
Drv.addMarker([config['lng'], config['lat']], config);
|
||||
}
|
||||
|
||||
console.log(`${NAME}: Map is loaded`);
|
||||
});
|
||||
|
||||
$el.data(DATA_KEY, ui);
|
||||
$el.addClass(`${NAME}-active`);
|
||||
|
||||
$el.trigger(Events.MAPLOADED);
|
||||
console.log(`${NAME}: Map is loaded`);
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
|
Loading…
Reference in New Issue
Block a user