зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1750952 - [devtools] Migrate all expressions selectors to a selector module. r=bomsy
Differential Revision: https://phabricator.services.mozilla.com/D136891
This commit is contained in:
Родитель
5ce285893a
Коммит
04e9956947
|
@ -7,7 +7,6 @@
|
|||
* @module reducers/expressions
|
||||
*/
|
||||
|
||||
import { createSelector } from "reselect";
|
||||
import { prefs } from "../utils/prefs";
|
||||
|
||||
export const initialExpressionState = () => ({
|
||||
|
@ -131,32 +130,4 @@ function deleteExpression(state, input) {
|
|||
return newState;
|
||||
}
|
||||
|
||||
const getExpressionsWrapper = state => state.expressions;
|
||||
|
||||
export const getExpressions = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.expressions
|
||||
);
|
||||
|
||||
export const getAutocompleteMatches = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.autocompleteMatches
|
||||
);
|
||||
|
||||
export function getExpression(state, input) {
|
||||
return getExpressions(state).find(exp => exp.input == input);
|
||||
}
|
||||
|
||||
export function getAutocompleteMatchset(state) {
|
||||
const input = state.expressions.currentAutocompleteInput;
|
||||
if (input) {
|
||||
return getAutocompleteMatches(state)[input];
|
||||
}
|
||||
}
|
||||
|
||||
export const getExpressionError = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.expressionError
|
||||
);
|
||||
|
||||
export default update;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* 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/>. */
|
||||
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
const getExpressionsWrapper = state => state.expressions;
|
||||
|
||||
export const getExpressions = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.expressions
|
||||
);
|
||||
|
||||
const getAutocompleteMatches = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.autocompleteMatches
|
||||
);
|
||||
|
||||
export function getExpression(state, input) {
|
||||
return getExpressions(state).find(exp => exp.input == input);
|
||||
}
|
||||
|
||||
export function getAutocompleteMatchset(state) {
|
||||
const input = state.expressions.currentAutocompleteInput;
|
||||
if (input) {
|
||||
return getAutocompleteMatches(state)[input];
|
||||
}
|
||||
}
|
||||
|
||||
export const getExpressionError = createSelector(
|
||||
getExpressionsWrapper,
|
||||
expressions => expressions.expressionError
|
||||
);
|
|
@ -2,7 +2,6 @@
|
|||
* 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/>. */
|
||||
|
||||
export * from "../reducers/expressions";
|
||||
export * from "../reducers/tabs";
|
||||
export * from "../reducers/threads";
|
||||
|
||||
|
@ -17,6 +16,7 @@ export {
|
|||
export { getBreakpointSources } from "./breakpointSources";
|
||||
export * from "./event-listeners";
|
||||
export * from "./exceptions";
|
||||
export * from "./expressions";
|
||||
export * from "./file-search";
|
||||
export { getCallStackFrames } from "./getCallStackFrames";
|
||||
export { isLineInScope } from "./isLineInScope";
|
||||
|
|
|
@ -12,6 +12,7 @@ CompiledModules(
|
|||
"breakpointSources.js",
|
||||
"event-listeners.js",
|
||||
"exceptions.js",
|
||||
"expressions.js",
|
||||
"file-search.js",
|
||||
"getCallStackFrames.js",
|
||||
"index.js",
|
||||
|
|
Загрузка…
Ссылка в новой задаче