Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

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.35 Sekunden]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002