@@ -24,7 +24,7 @@ function deprecateParam(oldParam, newParam) {
24
24
/* eslint-enable no-console */
25
25
}
26
26
27
- const devToolsExtension = function ( reducer , preloadedState , config ) {
27
+ const __REDUX_DEVTOOLS_EXTENSION__ = function ( reducer , preloadedState , config ) {
28
28
/* eslint-disable no-param-reassign */
29
29
if ( typeof reducer === 'object' ) {
30
30
config = reducer ; reducer = undefined ;
@@ -288,16 +288,56 @@ const devToolsExtension = function(reducer, preloadedState, config) {
288
288
} ;
289
289
290
290
// noinspection JSAnnotator
291
- window . devToolsExtension = devToolsExtension ;
292
- window . devToolsExtension . open = openWindow ;
293
- window . devToolsExtension . updateStore = updateStore ( stores ) ;
294
- window . devToolsExtension . notifyErrors = notifyErrors ;
295
- window . devToolsExtension . send = sendMessage ;
296
- window . devToolsExtension . listen = setListener ;
297
- window . devToolsExtension . connect = connect ;
298
- window . devToolsExtension . disconnect = disconnect ;
299
-
300
- window . __REDUX_DEVTOOLS_EXTENSION__ = window . devToolsExtension ;
291
+ window . __REDUX_DEVTOOLS_EXTENSION__ = __REDUX_DEVTOOLS_EXTENSION__ ;
292
+ window . __REDUX_DEVTOOLS_EXTENSION__ . open = openWindow ;
293
+ window . __REDUX_DEVTOOLS_EXTENSION__ . updateStore = updateStore ( stores ) ;
294
+ window . __REDUX_DEVTOOLS_EXTENSION__ . notifyErrors = notifyErrors ;
295
+ window . __REDUX_DEVTOOLS_EXTENSION__ . send = sendMessage ;
296
+ window . __REDUX_DEVTOOLS_EXTENSION__ . listen = setListener ;
297
+ window . __REDUX_DEVTOOLS_EXTENSION__ . connect = connect ;
298
+ window . __REDUX_DEVTOOLS_EXTENSION__ . disconnect = disconnect ;
299
+
300
+ // Deprecated
301
+ /* eslint-disable no-console */
302
+ let varNameDeprecatedWarned ;
303
+ const varNameDeprecatedWarn = ( ) => {
304
+ if ( varNameDeprecatedWarned ) return ;
305
+ console . warn ( '`window.devToolsExtension` is deprecated in favor of `window.__REDUX_DEVTOOLS_EXTENSION__`, and will be removed in next version of Redux DevTools: https://git.io/fpEJZ' ) ;
306
+ varNameDeprecatedWarned = true ;
307
+ } ;
308
+ /* eslint-enable no-console */
309
+ window . devToolsExtension = ( ...args ) => {
310
+ varNameDeprecatedWarn ( ) ;
311
+ return __REDUX_DEVTOOLS_EXTENSION__ . apply ( null , args ) ;
312
+ } ;
313
+ window . devToolsExtension . open = ( ...args ) => {
314
+ varNameDeprecatedWarn ( ) ;
315
+ return openWindow . apply ( null , args ) ;
316
+ } ;
317
+ window . devToolsExtension . updateStore = ( ...args ) => {
318
+ varNameDeprecatedWarn ( ) ;
319
+ return updateStore ( stores ) . apply ( null , args ) ;
320
+ } ;
321
+ window . devToolsExtension . notifyErrors = ( ...args ) => {
322
+ varNameDeprecatedWarn ( ) ;
323
+ return notifyErrors . apply ( null , args ) ;
324
+ } ;
325
+ window . devToolsExtension . send = ( ...args ) => {
326
+ varNameDeprecatedWarn ( ) ;
327
+ return sendMessage . apply ( null , args ) ;
328
+ } ;
329
+ window . devToolsExtension . listen = ( ...args ) => {
330
+ varNameDeprecatedWarn ( ) ;
331
+ return setListener . apply ( null , args ) ;
332
+ } ;
333
+ window . devToolsExtension . connect = ( ...args ) => {
334
+ varNameDeprecatedWarn ( ) ;
335
+ return connect . apply ( null , args ) ;
336
+ } ;
337
+ window . devToolsExtension . disconnect = ( ...args ) => {
338
+ varNameDeprecatedWarn ( ) ;
339
+ return disconnect . apply ( null , args ) ;
340
+ } ;
301
341
302
342
const preEnhancer = instanceId => next =>
303
343
( reducer , preloadedState , enhancer ) => {
@@ -322,14 +362,14 @@ const extensionCompose = (config) => (...funcs) => {
322
362
return ( ...args ) => {
323
363
const instanceId = generateId ( config . instanceId ) ;
324
364
return [ preEnhancer ( instanceId ) , ...funcs ] . reduceRight (
325
- ( composed , f ) => f ( composed ) , devToolsExtension ( { ...config , instanceId } ) ( ...args )
365
+ ( composed , f ) => f ( composed ) , __REDUX_DEVTOOLS_EXTENSION__ ( { ...config , instanceId } ) ( ...args )
326
366
) ;
327
367
} ;
328
368
} ;
329
369
330
370
window . __REDUX_DEVTOOLS_EXTENSION_COMPOSE__ = ( ...funcs ) => {
331
371
if ( funcs . length === 0 ) {
332
- return devToolsExtension ( ) ;
372
+ return __REDUX_DEVTOOLS_EXTENSION__ ( ) ;
333
373
}
334
374
if ( funcs . length === 1 && typeof funcs [ 0 ] === 'object' ) {
335
375
return extensionCompose ( funcs [ 0 ] ) ;
0 commit comments