File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -735,16 +735,35 @@ MapboxGeocoder.prototype = {
735735
736736 const requestType = this . _requestType ( this . options , searchInput ) ;
737737
738- let config ;
738+ var config ;
739739 // setup request parameters config and pre-validate values
740740 try {
741741 config = this . _setupConfig ( requestType , searchInput ) ;
742742 } catch ( err ) {
743- this . _hideLoadingIcon ( ) ;
744- this . _hideAttribution ( ) ;
745- this . _typeahead . selected = null ;
746- this . _renderCustomError ( err . message ) ;
747- return Promise . resolve ( ) ;
743+ const request = new Promise ( function ( resolve ) {
744+ resolve ( ) ;
745+ } ) ;
746+ request . then ( function ( ) {
747+ return {
748+ type : 'FeatureCollection' ,
749+ features : [ ] ,
750+ config
751+ }
752+ } . bind ( this ) )
753+ . then ( function ( ) {
754+ this . _hideLoadingIcon ( ) ;
755+ this . _hideAttribution ( ) ;
756+ this . _typeahead . selected = null ;
757+ this . _renderCustomError ( err . message ) ;
758+ this . _eventEmitter . emit ( 'results' , {
759+ type : 'FeatureCollection' ,
760+ features : [ ] ,
761+ config
762+ } ) ;
763+ this . _eventEmitter . emit ( 'error' , { error : err } ) ;
764+
765+ } . bind ( this ) )
766+ return request
748767 }
749768
750769 var request ;
You can’t perform that action at this time.
0 commit comments