Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  serial_worker_access.js

  Sprache: JAVA
 

/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

/* global SerialPort */
"use strict";

function test(condition, message) {
  self.postMessage({
    type: "test",
    result: condition,
    message,
  });
}

async function runTests() {
  try {
    const ports = await navigator.serial.getPorts();

    test(Array.isArray(ports), "getPorts() should return an array in worker");

    test(
      !!ports.length,
      "getPorts() should return ports granted in window context"
    );

    const port = ports[0];

    test(
      port instanceof SerialPort,
      "Port from getPorts() should be a SerialPort instance in worker"
    );

    test(
      typeof port.connected === "boolean",
      "Port should have connected property in worker"
    );

    test(
      port.connected === true,
      "Port should be connected initially in worker"
    );

    test("readable" in port, "Port should have readable property in worker");

    test(
      port.readable === null,
      "Port readable should be null when closed in worker"
    );

    test("writable" in port, "Port should have writable property in worker");

    test(
      port.writable === null,
      "Port writable should be null when closed in worker"
    );

    test(
      typeof port.getInfo === "function",
      "Port should have getInfo method in worker"
    );

    const info = port.getInfo();
    test(
      typeof info === "object" && info !== null,
      "getInfo() should return an object in worker"
    );
    test(info.usbVendorId === 0x2341, "Port should have correct usbVendorId");
    test(info.usbProductId === 0x0043, "Port should have correct usbProductId");

    test(
      typeof port.open === "function",
      "Port should have open method in worker"
    );

    test(
      typeof port.close === "function",
      "Port should have close method in worker"
    );

    test(
      typeof port.getSignals === "function",
      "Port should have getSignals method in worker"
    );

    test(
      typeof port.setSignals === "function",
      "Port should have setSignals method in worker"
    );

    test(
      typeof port.forget === "function",
      "Port should have forget method in worker"
    );

    self.postMessage({ type: "done" });
  } catch (e) {
    self.postMessage({
      type: "error",
      message: `Test failed: ${e.name}: ${e.message}`,
    });
  }
}

runTests();

Messung V0.5 in Prozent
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© 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=277311
#Domains=752002