|
3 | 3 | */ |
4 | 4 | import { awaitGBKitGlobal } from './bridge'; |
5 | 5 | import { loadEditorAssets } from './editor-loader'; |
6 | | -import { initializeAjax } from './ajax'; |
| 6 | +import { configureAjax } from './ajax'; |
7 | 7 | import { error, warn } from './logger'; |
8 | 8 | import { isDevMode } from './dev-mode'; |
9 | 9 | import './editor-styles.js'; |
@@ -32,7 +32,7 @@ export function initializeRemoteEditor() { |
32 | 32 | .then( importL10n ) |
33 | 33 | .then( configureLocale ) // Configure locale before loading modules with strings |
34 | 34 | .then( loadApiFetch ) |
35 | | - .then( initializeApiFetch ) // Configure API fetch before loading remaining modules |
| 35 | + .then( configureNetworkingUtils ) // Configure AJAX and api-fetch before loading remaining modules |
36 | 36 | .then( loadRemainingAssets ) |
37 | 37 | .then( initializeEditor ) |
38 | 38 | .catch( handleError ); |
@@ -61,18 +61,16 @@ function loadRemainingAssets() { |
61 | 61 | } ); |
62 | 62 | } |
63 | 63 |
|
64 | | -function initializeApiFetch( assetsResult ) { |
65 | | - return import( './api-fetch' ).then( |
66 | | - ( { initializeApiFetch: _initializeApiFetch } ) => { |
67 | | - _initializeApiFetch(); |
68 | | - return assetsResult; |
69 | | - } |
70 | | - ); |
| 64 | +function configureNetworkingUtils( assetsResult ) { |
| 65 | + configureAjax(); |
| 66 | + |
| 67 | + return import( './api-fetch' ).then( ( { configureApiFetch } ) => { |
| 68 | + configureApiFetch(); |
| 69 | + return assetsResult; |
| 70 | + } ); |
71 | 71 | } |
72 | 72 |
|
73 | 73 | function initializeEditor( assetsResult ) { |
74 | | - initializeAjax(); |
75 | | - |
76 | 74 | const { allowedBlockTypes } = assetsResult; |
77 | 75 | return import( './editor' ).then( |
78 | 76 | ( { initializeEditor: _initializeEditor } ) => { |
|
0 commit comments