All files / src/lib/events eventMuteChannel.js

0% Statements 0/10
0% Branches 0/2
0% Functions 0/1
0% Lines 0/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                                                                                         
const l10n = require("../helpers/l10n").default;
 
const id = "EVENT_MUTE_CHANNEL";
const groups = ["EVENT_GROUP_MUSIC"];
const subGroups = {
  EVENT_GROUP_MUSIC: "FIELD_STOP",
};
 
const fields = [
  {
    key: "channels",
    label: l10n("FIELD_ACTIVE_CHANNELS"),
    description: l10n("FIELD_ACTIVE_CHANNELS_DESC"),
    type: "togglebuttons",
    options: [
      [0, "Duty 1"],
      [1, "Duty 2"],
      [2, "Wave"],
      [3, "Noise"],
    ],
    allowMultiple: true,
    allowNone: true,
  },
];
 
const compile = (input, helpers) => {
  const { musicSetMuteMask } = helpers;
  const channels = input.channels || [];
  musicSetMuteMask(
    channels.indexOf(0) > -1,
    channels.indexOf(1) > -1,
    channels.indexOf(2) > -1,
    channels.indexOf(3) > -1
  );
};
 
module.exports = {
  id,
  description: l10n("EVENT_MUTE_CHANNEL_DESC"),
  groups,
  subGroups,
  fields,
  compile,
};