workers.js (1017B)
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 START_WORKER, 9 UNREGISTER_WORKER, 10 UPDATE_CAN_DEBUG_WORKERS, 11 UPDATE_WORKERS, 12 } = require("resource://devtools/client/application/src/constants.js"); 13 14 function startWorker(worker) { 15 const { registrationFront } = worker; 16 registrationFront.start(); 17 18 return { 19 type: START_WORKER, 20 }; 21 } 22 23 function unregisterWorker(registration) { 24 const { registrationFront } = registration; 25 registrationFront.unregister(); 26 27 return { 28 type: UNREGISTER_WORKER, 29 }; 30 } 31 32 function updateWorkers(workers) { 33 return { 34 type: UPDATE_WORKERS, 35 workers, 36 }; 37 } 38 39 function updateCanDebugWorkers(canDebugWorkers) { 40 return { 41 type: UPDATE_CAN_DEBUG_WORKERS, 42 canDebugWorkers, 43 }; 44 } 45 46 module.exports = { 47 startWorker, 48 unregisterWorker, 49 updateCanDebugWorkers, 50 updateWorkers, 51 };