Plan Checker (neues Studenten-Werkzeug, Seitenleiste + Admin → Plan-Checker- Merkmale): lädt einen Bauplan als PDF hoch und lässt ChatGPT oder Claude ihn gegen eine gepflegte Merkmalsliste prüfen. PDF-Rendering (pdf.js + @napi-rs/canvas) berücksichtigt jetzt Ebenen (Optional Content Groups) und WASM-Decoder korrekt, sendet eine Übersicht plus mehrere hochaufgelöste Kachel-Ausschnitte statt eines einzelnen, zu groben Bilds, und beide Anbieter bekommen dasselbe Bildmaterial. Jedes Prüfergebnis kann auf eines der gesendeten Bilder als Beleg verweisen (bildIndex) — als Screenshot im Ergebnis anklickbar, öffnet vergrößert in einem Modal statt eines von Chrome blockierten target=_blank-Links auf eine data:-URL. KI-Modellname ist jetzt pro Konto überschreibbar (Einstellungen → Mein Konto) für Drittanbieter mit abweichendem Modell-Katalog. Wochenbericht: dichte Kartenansicht bekommt einen Fokus-Modus — nur der Kommentar liegt offen, Leistungsphasen und Beteiligte stecken in aufklappbaren Abschnitten statt dauerhaft nebeneinander zu stehen. Projektbereich: Terminplan-Auslastung rechnet jetzt exakt wie der Auslastungs-Tab/die Wandtafel (statt einer unabhängigen, tageweisen Schätzung); die LPH-Fortschrittsliste im Dashboard zeigt nur noch die beauftragten Leistungsphasen. Wandtafel: Dashboard-Kopf mit Kennzahlen-Reihe und Panel-Reihe neu strukturiert, in den Blautönen des Firmenlogos; dieselbe Palette wurde anschließend auf den gesamten App-weiten Dark Mode übernommen. Dateibereinigung: nicht mehr benötigte Test-Uploads/Backups entfernt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3.2 KiB
Global Installation
Stability: 2 - Stable
undici ships its own implementations of several WHATWG web APIs. The install()
function assigns those implementations onto globalThis, so they can be used
without importing them from 'undici' first. This is useful for polyfilling
environments, guaranteeing consistent behavior across Node.js versions, and
satisfying third-party libraries that expect the relevant classes to be global.
import { install } from 'undici'
install()
// `fetch`, `Headers`, `Response`, `Request`, etc. now resolve to undici's
// implementations.
const response = await fetch('https://example.com')
const { install } = require('undici')
install()
install()
- Returns: {undefined}
Overwrites the following properties of globalThis with undici's
implementations:
globalThis.fetchglobalThis.HeadersglobalThis.ResponseglobalThis.RequestglobalThis.FormDataglobalThis.WebSocketglobalThis.CloseEventglobalThis.ErrorEventglobalThis.MessageEventglobalThis.EventSource
Each installed value is the same object exported by 'undici' under the
matching name, so the global identifiers form a single, self-consistent set.
The assignment is unconditional: any pre-existing global of the same name,
including the Node.js built-in, is replaced. The change persists for the
lifetime of the process. Calling install() more than once is safe and simply
re-assigns the same values.
Documentation for each installed class lives on its own page: see
fetch, WebSocket, and EventSource.
import { install } from 'undici'
install()
const headers = new Headers([['content-type', 'application/json']])
const request = new Request('https://example.com')
const formData = new FormData()
const ws = new WebSocket('wss://example.com')
const eventSource = new EventSource('https://example.com/events')
Pairing fetch and FormData
When a request body is a FormData instance, the fetch and FormData
implementations must come from the same source. After install(), both globals
resolve to undici, so they always match:
import { install } from 'undici'
install()
const body = new FormData()
await fetch('https://example.com', { method: 'POST', body })
If global installation is not desired, import the matching pair directly from
'undici' instead:
import { fetch, FormData } from 'undici'
const body = new FormData()
await fetch('https://example.com', { method: 'POST', body })
Mixing a global FormData with undici.fetch(), or undici.FormData with the
built-in global fetch(), can produce surprising multipart behavior across
Node.js and undici versions. Keep the two paired.
Conditional installation
install() can be guarded so undici's fetch is only installed when no global
fetch already exists:
import { install } from 'undici'
if (typeof globalThis.fetch === 'undefined') {
install()
}
const response = await fetch('https://example.com')