skipPausing.js (951B)
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 import { getSkipPausing } from "../../selectors/index"; 6 7 /** 8 * @memberof actions/pause 9 * @static 10 */ 11 export function toggleSkipPausing() { 12 return async ({ dispatch, client, getState }) => { 13 const skipPausing = !getSkipPausing(getState()); 14 await client.setSkipPausing(skipPausing); 15 dispatch({ type: "TOGGLE_SKIP_PAUSING", skipPausing }); 16 }; 17 } 18 19 /** 20 * @memberof actions/pause 21 * @static 22 */ 23 export function setSkipPausing(skipPausing) { 24 return async ({ dispatch, client, getState }) => { 25 const currentlySkipping = getSkipPausing(getState()); 26 if (currentlySkipping === skipPausing) { 27 return; 28 } 29 30 await client.setSkipPausing(skipPausing); 31 dispatch({ type: "TOGGLE_SKIP_PAUSING", skipPausing }); 32 }; 33 }