Public
Edited
Aug 25, 2024
9 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fsm = new StateMachine({
init: "solid",
transitions: [
{ name: "melt", from: "solid", to: "liquid" },
{ name: "freeze", from: "liquid", to: "solid" },
{ name: "vaporize", from: "liquid", to: "gas" },
{ name: "condense", from: "gas", to: "liquid" }
],
methods: {
onMelt: function () {
viewof output.value = "I melted";
},
onFreeze: function () {
viewof output.value = "I froze";
},
onVaporize: function () {
viewof output.value = "I vaporized";
},
onCondense: function () {
viewof output.value = "I condensed";
},
// Always trigger dataflow on output cell after a change
onAfterTransition: () => viewof output.dispatchEvent(new Event("input"))
}
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more