reducer.js (698B)
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 CHANGE_NETWORK_THROTTLING, 9 } = require("resource://devtools/client/shared/components/throttling/actions.js"); 10 11 const INITIAL_STATE = { 12 enabled: false, 13 profile: "", 14 }; 15 16 function throttlingReducer(state = INITIAL_STATE, action) { 17 switch (action.type) { 18 case CHANGE_NETWORK_THROTTLING: { 19 return { 20 enabled: action.enabled, 21 profile: action.profile, 22 }; 23 } 24 default: 25 return state; 26 } 27 } 28 29 module.exports = throttlingReducer;