mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
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:
parent
63ab1f2c5b
commit
a1f2cba28e
@ -6,5 +6,4 @@
|
||||
DevToolsModules(
|
||||
'event-telemetry.js',
|
||||
'history-persistence.js',
|
||||
'thunk.js',
|
||||
)
|
||||
|
@ -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;
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user