} = require("resource://devtools/client/memory/actions/refresh.js"); const { debounce } = require("resource://devtools/shared/debounce.js"); const { isIgnoringActions, } = require("resource://devtools/client/shared/redux/middleware/ignore.js"); const setFilterString = (exports.setFilterString = function (filterString) { return { type: actions.SET_FILTER_STRING, filter: filterString, }; }); // The number of milliseconds we should wait before kicking off a new census // when the filter string is updated. This helps us avoid doing any work while // the user is still typing. const FILTER_INPUT_DEBOUNCE_MS = 250; const debouncedRefreshDispatcher = debounce( (dispatch, getState, heapWorker) => { // Prevent dispatching the action if the panel is already being destroying. // For some reason, throwing the ignore middle exception introduce a leak. if (isIgnoringActions(getState())) { return; } dispatch(refresh(heapWorker)); }, FILTER_INPUT_DEBOUNCE_MS ); exports.setFilterStringAndRefresh = function (filterString, heapWorker) { return ({ dispatch, getState }) => { dispatch(setFilterString(filterString)); debouncedRefreshDispatcher(dispatch, getState, heapWorker); }; }; PK