sizes.js (731B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { actions } = require("resource://devtools/client/memory/constants.js"); 7 const { 8 immutableUpdate, 9 } = require("resource://devtools/shared/DevToolsUtils.js"); 10 11 const handlers = Object.create(null); 12 13 handlers[actions.RESIZE_SHORTEST_PATHS] = function (sizes, { size }) { 14 return immutableUpdate(sizes, { shortestPathsSize: size }); 15 }; 16 17 module.exports = function (sizes = { shortestPathsSize: 0.5 }, action) { 18 const handler = handlers[action.type]; 19 return handler ? handler(sizes, action) : sizes; 20 };