Eine aufbereitete Darstellung der Quelle

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

Benutzer

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

/**
 * An object of this type represents an original source for the style
 * editor.  An "original" source is one that is mentioned in a source
 * map.
 *
 * @param {String} url
 *        The URL of the original source.
 * @param {String} sourceID
 *        The source ID of the original source, as used by the source
 *        map service.
 * @param {SourceMapLoader} sourceMapLoader
 *        The source map loader; @see Toolbox.sourceMapLoader
 */

function OriginalSource(url, sourceId, sourceMapLoader) {
  this.isOriginalSource = true;

  this._url = url;
  this._sourceId = sourceId;
  this._sourceMapLoader = sourceMapLoader;
}

OriginalSource.prototype = {
  get sourceId() {
    return this._sourceId;
  },

  /** Get the original source's URL.  */
  get url() {
    return this._url;
  },

  /** Get the original source's URL.  */
  get href() {
    return this._url;
  },

  /**
   * Return a promise that will resolve to the original source's full
   * text.  The return result is actually an object with a single
   * `string` method; this method will return the source text as a
   * string.  This is done because the style editor elsewhere expects
   * a long string actor.
   */

  getText() {
    if (!this._sourcePromise) {
      this._sourcePromise = this._sourceMapLoader
        .getOriginalSourceText(this._sourceId)
        .then(contents => {
          // Make it look like a long string actor.
          return {
            string: () => contents.text,
          };
        });
    }
    return this._sourcePromise;
  },

  /**
   * Given a source-mapped, generated style sheet, a line, and a
   * column, return the corresponding original location in this style
   * sheet.
   *
   * @param {StyleSheetResource} relatedSheet
   *        The generated style sheet's resource
   * @param {Number} line
   *        Line number.
   * @param {Number} column
   *        Column number.
   * @return {Location}
   *        The original location, an object with at least
   *        `sourceUrl`, `source`, `styleSheet`, `line`, and `column`
   *        properties.
   */

  getOriginalLocation(relatedSheet, line, column) {
    const { href, nodeHref, resourceId: sourceId } = relatedSheet;
    const sourceUrl = href || nodeHref;
    return this._sourceMapLoader
      .getOriginalLocation({
        sourceId,
        line,
        column,
        sourceUrl,
      })
      .then(location => {
        // Add some properties for the style editor.
        location.source = location.sourceUrl;
        location.styleSheet = relatedSheet;
        return location;
      });
  },

  // Dummy implementations, as we never emit an event.
  on() {},
  off() {},
};

exports.OriginalSource = OriginalSource;

Messung V0.5 in Prozent
C=92 H=100 G=95

¤ Dauer der Verarbeitung: 0.19 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© 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

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik