Bug 1582700 - Remove webconsole specific thunk and use shared thunk-with-options. r=Honza.

Differential Revision: https://phabricator.services.mozilla.com/D47577

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-10-01 09:48:08 +00:00
parent 63ab1f2c5b
commit a1f2cba28e
3 changed files with 5 additions and 22 deletions

View File

@ -6,5 +6,4 @@
DevToolsModules(
'event-telemetry.js',
'history-persistence.js',
'thunk.js',
)

View File

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* A middleware that allows thunks (functions) to be dispatched.
*/
function thunk(options = {}, { dispatch, getState }) {
return next => action => {
return typeof action === "function"
? action({ dispatch, getState, ...options })
: next(action);
};
}
module.exports = thunk;

View File

@ -22,10 +22,12 @@ const { getPrefsService } = require("devtools/client/webconsole/utils/prefs");
// Reducers
const { reducers } = require("./reducers/index");
// Middleware
// Middlewares
const eventTelemetry = require("./middleware/event-telemetry");
const historyPersistence = require("./middleware/history-persistence");
const thunk = require("./middleware/thunk");
const {
thunkWithOptions,
} = require("devtools/client/shared/redux/middleware/thunk-with-options");
// Enhancers
const enableBatching = require("./enhancers/batching");
@ -86,7 +88,7 @@ function configureStore(webConsoleUI, options = {}) {
const services = options.services || {};
const middleware = applyMiddleware(
thunk.bind(null, {
thunkWithOptions.bind(null, {
prefsService,
services,
// Needed for the ObjectInspector