BetaThis function can't be called in early-execution mode.
Subscribes a callback to any changes that occur to the
Observable. The return value can be passed into the
unsubscribe function to stop listening to changes.
This function can't be called in early-execution mode.
Unsubscribe a callback from any changes that occur to the
Observable. This takes the return value from the subscribe
function.
This function can't be called in early-execution mode.
StaticcreateOptionaloptions: ObservableOptionsThis function can't be called in early-execution mode.
import { Observable } from "@minecraft/server-ui";
// Read-only Observable (server controls the value)
const status = Observable.create<string>("Loading...");
// Client-writable Observable (UI controls can update it)
const userInput = Observable.create<string>("", { clientWritable: true });
A class that represents data that can be Observed. Extensively used for UI.
Example: dynamicLabel.ts
Example: subscribeToChanges.ts
Example: updateValues.ts