Observer in ReasonML
Reactive data streams and magical listeners.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Sensory
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// REASON PATTERN //
module Observable = {
let listeners = ref([]);
let subscribe = (cb) => listeners := [cb, ...listeners^];
let notify = (data) => List.iter(cb => cb(data), listeners^);
};
The Observer binds familiar imperative callbacks to a centralized registry, often handled seamlessly through React/ReasonReact primitives or RxJS hexes.
Runic Tags:
#reason
#observer
#behavioral