Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/modules/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  FinderSound.sys.mjs   Sprache: unbekannt

 
Spracherkennung für: .mjs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

// 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/.

const kSoundEnabledPref = "accessibility.typeaheadfind.enablesound";
const kNotFoundSoundPref = "accessibility.typeaheadfind.soundURL";
const kWrappedSoundPref = "accessibility.typeaheadfind.wrappedSoundURL";

import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";

const lazy = {};

XPCOMUtils.defineLazyPreferenceGetter(
  lazy,
  "isSoundEnabled",
  kSoundEnabledPref,
  false
);

XPCOMUtils.defineLazyPreferenceGetter(
  lazy,
  "notFoundSoundURL",
  kNotFoundSoundPref,
  ""
);

XPCOMUtils.defineLazyPreferenceGetter(
  lazy,
  "wrappedSoundURL",
  kWrappedSoundPref,
  ""
);

let gSound = null;

export function resetSound() {
  gSound = null;
}

export function initSound() {
  if (!gSound && lazy.isSoundEnabled) {
    try {
      gSound = Cc["@mozilla.org/sound;1"].getService(Ci.nsISound);
      gSound.init();
    } catch (ex) {}
  }
}

export function playSound(event) {
  if (!lazy.isSoundEnabled) {
    return;
  }

  initSound();
  if (!gSound) {
    return;
  }

  let soundUrl;

  switch (event) {
    case "not-found":
      soundUrl = lazy.notFoundSoundURL;
      break;
    case "wrapped":
      soundUrl = lazy.wrappedSoundURL;
      break;
    default:
      return;
  }

  if (soundUrl == "beep") {
    gSound.beep();
  }
}

[Dauer der Verarbeitung: 0.24 Sekunden, vorverarbeitet 2026-08-25]