tree-map-display.js (680B)
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 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 actions, 9 treeMapDisplays, 10 } = require("resource://devtools/client/memory/constants.js"); 11 const DEFAULT_TREE_MAP_DISPLAY = treeMapDisplays.coarseType; 12 13 const handlers = Object.create(null); 14 15 handlers[actions.SET_TREE_MAP_DISPLAY] = function (_, { display }) { 16 return display; 17 }; 18 19 module.exports = function (state = DEFAULT_TREE_MAP_DISPLAY, action) { 20 const handler = handlers[action.type]; 21 return handler ? handler(state, action) : state; 22 };