File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,6 @@ export var RequestJSONPPromise = {
3131 uid = me . getUid ( ) ,
3232 url = config . url ,
3333 splitQuestUrl = [ ] ;
34- var p = new Promise ( function ( resolve ) {
35- me . supermap_callbacks [ uid ] = function ( response ) {
36- delete me . supermap_callbacks [ uid ] ;
37- resolve ( response ) ;
38- } ;
39- } ) ;
4034
4135 // me.addQueryStrings({
4236 // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
@@ -94,12 +88,11 @@ export var RequestJSONPPromise = {
9488 }
9589 }
9690 splitQuestUrl . push ( sectionURL ) ;
97- me . send (
91+ return me . send (
9892 splitQuestUrl ,
99- 'RequestJSONPPromise.supermap_callbacks[ ' + uid + ']' ,
93+ 'SuperMapJSONPCallbacks_ ' + uid ,
10094 config && config . proxy
10195 ) ;
102- return p ;
10396 } ,
10497
10598 getUid : function ( ) {
@@ -126,9 +119,11 @@ export var RequestJSONPPromise = {
126119 url = decodeURIComponent ( url ) ;
127120 url = proxy + encodeURIComponent ( url ) ;
128121 }
129- fetchJsonp ( url , {
122+ return fetchJsonp ( url , {
130123 jsonpCallbackFunction : callback ,
131124 timeout : 30000
125+ } ) . then ( ( result ) => {
126+ return result . json ( ) ;
132127 } ) ;
133128 }
134129 }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ describe('FetchRequest', () => {
88 fetch = jasmine . createSpy ( 'fetch' ) . and . resolveTo ( { success : 'ok' } ) ;
99 setFetch ( fetch ) ;
1010 } ) ;
11- xit ( 'RequestJSONPPromise' , ( ) => {
11+ it ( 'RequestJSONPPromise' , ( ) => {
1212 var url = 'http://test.supermap.io/examples/leaflet/editor.html#addressMatchService' ;
1313 var params ;
1414 var options ;
You can’t perform that action at this time.
0 commit comments