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 = {
31
31
uid = me . getUid ( ) ,
32
32
url = config . url ,
33
33
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
- } ) ;
40
34
41
35
// me.addQueryStrings({
42
36
// callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
@@ -94,12 +88,11 @@ export var RequestJSONPPromise = {
94
88
}
95
89
}
96
90
splitQuestUrl . push ( sectionURL ) ;
97
- me . send (
91
+ return me . send (
98
92
splitQuestUrl ,
99
- 'RequestJSONPPromise.supermap_callbacks[ ' + uid + ']' ,
93
+ 'SuperMapJSONPCallbacks_ ' + uid ,
100
94
config && config . proxy
101
95
) ;
102
- return p ;
103
96
} ,
104
97
105
98
getUid : function ( ) {
@@ -126,9 +119,11 @@ export var RequestJSONPPromise = {
126
119
url = decodeURIComponent ( url ) ;
127
120
url = proxy + encodeURIComponent ( url ) ;
128
121
}
129
- fetchJsonp ( url , {
122
+ return fetchJsonp ( url , {
130
123
jsonpCallbackFunction : callback ,
131
124
timeout : 30000
125
+ } ) . then ( ( result ) => {
126
+ return result . json ( ) ;
132
127
} ) ;
133
128
}
134
129
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ describe('FetchRequest', () => {
8
8
fetch = jasmine . createSpy ( 'fetch' ) . and . resolveTo ( { success : 'ok' } ) ;
9
9
setFetch ( fetch ) ;
10
10
} ) ;
11
- xit ( 'RequestJSONPPromise' , ( ) => {
11
+ it ( 'RequestJSONPPromise' , ( ) => {
12
12
var url = 'http://test.supermap.io/examples/leaflet/editor.html#addressMatchService' ;
13
13
var params ;
14
14
var options ;
You can’t perform that action at this time.
0 commit comments