Skip to content

Commit 48597ec

Browse files
committed
Added callbackAutoGeoSuccess callback that fires after the geolocation API returns a successful result
1 parent 151aeeb commit 48597ec

File tree

6 files changed

+32
-3
lines changed

6 files changed

+32
-3
lines changed

callbacks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ $('#bh-sl-map-container').storeLocator({
2929

3030
| Function | Description |
3131
|---|---|
32+
| [callbackAutoGeoSuccess](callbacks/callback-autogeosuccess.md) | Geolocation success callback |
3233
| [callbackNotify](callbacks/callback-notification.md) | Notification callback |
3334
| [callbackRegion](callbacks/callback-region.md) | Region callback |
3435
| [callbackFormVals](callbacks/callback-formvals.md) | Form values callback |

callbacks/callback-autogeosuccess.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# callbackAutoGeoSuccess
2+
3+
## Description
4+
5+
Fires after geolocation API returns a successful result.
6+
7+
## Parameters
8+
9+
| Name | Type | Description |
10+
|---|---|---|
11+
| pos | object | Object containing the geolocaiton API coordinates and accuracy |

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
'markerCluster' : null,
9696
'infoBubble' : null,
9797
// Callbacks
98+
'callbackAutoGeoSuccess' : null,
9899
'callbackNotify' : null,
99100
'callbackRegion' : null,
100101
'callbackFormVals' : null,
@@ -693,10 +694,17 @@
693694
accuracy : position.coords.accuracy
694695
}
695696
};
697+
696698
// Have to do this to get around scope issues
697699
if (_this.settings.sessionStorage === true && window.sessionStorage) {
698700
window.sessionStorage.setItem('myGeo',JSON.stringify(pos));
699701
}
702+
703+
// Callback
704+
if (_this.settings.callbackAutoGeoSuccess) {
705+
_this.settings.callbackAutoGeoSuccess.call(this, pos);
706+
}
707+
700708
_this.autoGeocodeQuery(pos);
701709
}, function(error){
702710
_this._autoGeocodeError(error);

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ filtering.
3737

3838
### Version 2.7.5
3939

40-
* Added callbackFormVals callback so form values can be utilized.
40+
* Added callbackAutoGeoSuccess callback that fires after the geolocation API returns a successful result.
41+
* Added callbackFormVals callback that fires after the form values have been processed from the form.
4142
* Fixed issue where HTML5 Geolocation was skipped when using the fullMapStartBlank setting.
4243

4344
### Version 2.7.4

src/js/jquery.storelocator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
'markerCluster' : null,
9393
'infoBubble' : null,
9494
// Callbacks
95+
'callbackAutoGeoSuccess' : null,
9596
'callbackNotify' : null,
9697
'callbackRegion' : null,
9798
'callbackFormVals' : null,
@@ -690,10 +691,17 @@
690691
accuracy : position.coords.accuracy
691692
}
692693
};
694+
693695
// Have to do this to get around scope issues
694696
if (_this.settings.sessionStorage === true && window.sessionStorage) {
695697
window.sessionStorage.setItem('myGeo',JSON.stringify(pos));
696698
}
699+
700+
// Callback
701+
if (_this.settings.callbackAutoGeoSuccess) {
702+
_this.settings.callbackAutoGeoSuccess.call(this, pos);
703+
}
704+
697705
_this.autoGeocodeQuery(pos);
698706
}, function(error){
699707
_this._autoGeocodeError(error);

0 commit comments

Comments
 (0)