Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/devtools/client/netmonitor/src/reducers/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  sort.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 {
  SORT_BY,
  RESET_COLUMNS,
} = require("resource://devtools/client/netmonitor/src/constants.js");

function Sort() {
  return {
    // null means: sort by "waterfall", but don't highlight the table header
    type: null,
    ascending: true,
  };
}

function sortReducer(state = new Sort(), action) {
  switch (action.type) {
    case SORT_BY: {
      if (action.sortType != null && action.sortType == state.type) {
        return {
          ...state,
          ascending: !state.ascending,
        };
      }
      if (state.type == action.sortType && state.ascending) {
        return state;
      }
      return {
        ...state,
        type: action.sortType,
        ascending: true,
      };
    }

    case RESET_COLUMNS: {
      if (state.type == null && state.ascending === true) {
        return state;
      }
      return {
        ...state,
        type: null,
        ascending: true,
      };
    }

    default:
      return state;
  }
}

module.exports = {
  Sort,
  sortReducer,
};

100%


¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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 ist noch experimentell.