Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  selection.js   Sprache: JAVA

 

/* 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 {
  SELECT_REQUEST,
} = require("resource://devtools/client/netmonitor/src/constants.js");
const {
  getDisplayedRequests,
  getSortedRequests,
} = require("resource://devtools/client/netmonitor/src/selectors/index.js");

const PAGE_SIZE_ITEM_COUNT_RATIO = 5;

/**
 * Select request with a given id.
 */

function selectRequest(id, request) {
  return {
    type: SELECT_REQUEST,
    id,
    request,
  };
}

/**
 * Select request with a given index (sorted order)
 */

function selectRequestByIndex(index) {
  return ({ dispatch, getState }) => {
    const requests = getSortedRequests(getState());
    let itemId;
    if (index >= 0 && index < requests.length) {
      itemId = requests[index].id;
    }
    dispatch(selectRequest(itemId));
  };
}

/**
 * Move the selection up to down according to the "delta" parameter. Possible values:
 * - Number: positive or negative, move up or down by specified distance
 * - "PAGE_UP" | "PAGE_DOWN" (String): page up or page down
 * - +Infinity | -Infinity: move to the start or end of the list
 */

function selectDelta(delta) {
  return ({ dispatch, getState }) => {
    const state = getState();
    const requests = getDisplayedRequests(state);

    if (!requests.length) {
      return;
    }

    const selIndex = requests.findIndex(
      r => r.id === state.requests.selectedId
    );

    if (delta === "PAGE_DOWN") {
      delta = Math.ceil(requests.length / PAGE_SIZE_ITEM_COUNT_RATIO);
    } else if (delta === "PAGE_UP") {
      delta = -Math.ceil(requests.length / PAGE_SIZE_ITEM_COUNT_RATIO);
    }

    const newIndex = Math.min(
      Math.max(0, selIndex + delta),
      requests.length - 1
    );
    const newItem = requests[newIndex];
    dispatch(selectRequest(newItem.id, newItem));
  };
}

module.exports = {
  selectRequest,
  selectRequestByIndex,
  selectDelta,
};

Messung V0.5 in Prozent
C=93 H=100 G=96

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-09-30) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691