grids.js (1379B)
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 UPDATE_GRID_COLOR, 9 UPDATE_GRID_HIGHLIGHTED, 10 UPDATE_GRIDS, 11 } = require("resource://devtools/client/inspector/grids/actions/index.js"); 12 13 module.exports = { 14 /** 15 * Updates the color used for the grid's highlighter. 16 * 17 * @param {NodeFront} nodeFront 18 * The NodeFront of the DOM node to toggle the grid highlighter. 19 * @param {string} color 20 * The color to use for this nodeFront's grid highlighter. 21 */ 22 updateGridColor(nodeFront, color) { 23 return { 24 type: UPDATE_GRID_COLOR, 25 color, 26 nodeFront, 27 }; 28 }, 29 30 /** 31 * Updates the grid highlighted state. 32 * 33 * @param {NodeFront} nodeFront 34 * The NodeFront of the DOM node to toggle the grid highlighter. 35 * @param {boolean} highlighted 36 * Whether or not the grid highlighter is highlighting the grid. 37 */ 38 updateGridHighlighted(nodeFront, highlighted) { 39 return { 40 type: UPDATE_GRID_HIGHLIGHTED, 41 highlighted, 42 nodeFront, 43 }; 44 }, 45 46 /** 47 * Updates the grid state with the new list of grids. 48 */ 49 updateGrids(grids) { 50 return { 51 type: UPDATE_GRIDS, 52 grids, 53 }; 54 }, 55 };