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


Quelle  promise.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";

// Make this available to both AMD and CJS environments
define(function (require, exports, module) {
  // ReactJS
  const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js");
  const {
    span,
  } = require("resource://devtools/client/shared/vendor/react-dom-factories.js");

  // Dependencies
  const {
    getGripType,
    wrapRender,
  } = require("resource://devtools/client/shared/components/reps/reps/rep-utils.js");

  const Grip = require("resource://devtools/client/shared/components/reps/reps/grip.js");
  const {
    MODE,
  } = require("resource://devtools/client/shared/components/reps/reps/constants.js");

  /**
   * Renders a DOM Promise object.
   */


  PromiseRep.propTypes = {
    object: PropTypes.object.isRequired,
    mode: PropTypes.oneOf(Object.values(MODE)),
    onDOMNodeMouseOver: PropTypes.func,
    onDOMNodeMouseOut: PropTypes.func,
    onInspectIconClick: PropTypes.func,
    shouldRenderTooltip: PropTypes.bool,
  };

  function PromiseRep(props) {
    const object = props.object;

    // @backward-compat { version 85 } On older servers, the preview of a promise was
    // useless and didn't include the internal promise state, which was directly exposed
    // in the grip.
    if (object.promiseState) {
      const { state, value, reason } = object.promiseState;
      const ownProperties = Object.create(null);
      ownProperties[""] = { value: state };
      let ownPropertiesLength = 1;
      if (state == "fulfilled") {
        ownProperties[""] = { value };
        ++ownPropertiesLength;
      } else if (state == "rejected") {
        ownProperties[""] = { value: reason };
        ++ownPropertiesLength;
      }
      object.preview = {
        kind: "Object",
        ownProperties,
        ownPropertiesLength,
      };
    }

    if (props.mode !== MODE.TINY && props.mode !== MODE.HEADER) {
      return Grip.rep(props);
    }

    const shouldRenderTooltip = props.shouldRenderTooltip;
    const config = {
      "data-link-actor-id": object.actor,
      className: "objectBox objectBox-object",
      title: shouldRenderTooltip ? "Promise" : null,
    };

    if (props.mode === MODE.HEADER) {
      return span(config, getTitle(object));
    }

    const {
      Rep,
    } = require("resource://devtools/client/shared/components/reps/reps/rep.js");

    return span(
      config,
      getTitle(object),
      span({ className: "objectLeftBrace" }, " { "),
      Rep({ object: object.preview.ownProperties[""].value }),
      span({ className: "objectRightBrace" }, " }")
    );
  }

  function getTitle(object) {
    return span({ className: "objectTitle" }, object.class);
  }

  // Registration
  function supportsObject(object, noGrip = false) {
    if (!Grip.supportsObject(object, noGrip)) {
      return false;
    }
    return getGripType(object, noGrip) == "Promise";
  }

  // Exports from this module
  module.exports = {
    rep: wrapRender(PromiseRep),
    supportsObject,
  };
});

Messung V0.5
C=89 H=100 G=94

¤ Dauer der Verarbeitung: 0.4 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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge