Loading homepage
Input: const values = []; const source = new Observable(s => { s.next(1); s.next(2); s.complete(); return () => values.push("cleanup"); }); const sub = source.subscribe({ next: x => values.push(x) }); [values, sub.closed]; Output: [[1, 2, "cleanup"], true]
Input: let emit; const source = new Observable(s => { emit = s; }); const sub = source.subscribe({ next: console.log }); sub.unsubscribe(); emit.next(3); Output: No value is delivered after unsubscribe.
Implement the exported API in index.js or index.ts. Tests cover the documented contract and edge cases.