summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/src/actions/workers.js
blob: 375dfe9ba7173aa70dcdb513d2eecd7a7bc0bccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

const {
  START_WORKER,
  UNREGISTER_WORKER,
  UPDATE_CAN_DEBUG_WORKERS,
  UPDATE_WORKERS,
} = require("resource://devtools/client/application/src/constants.js");

function startWorker(worker) {
  const { registrationFront } = worker;
  registrationFront.start();

  return {
    type: START_WORKER,
  };
}

function unregisterWorker(registration) {
  const { registrationFront } = registration;
  registrationFront.unregister();

  return {
    type: UNREGISTER_WORKER,
  };
}

function updateWorkers(workers) {
  return {
    type: UPDATE_WORKERS,
    workers,
  };
}

function updateCanDebugWorkers(canDebugWorkers) {
  return {
    type: UPDATE_CAN_DEBUG_WORKERS,
    canDebugWorkers,
  };
}

module.exports = {
  startWorker,
  unregisterWorker,
  updateCanDebugWorkers,
  updateWorkers,
};