OrderTracker has subscribe(callback) and update(status) — updating stores the status and calls every subscribed callback with it. Write it so callbacks added later miss earlier statuses (no replay). Demonstrate with a list-appending callback.t = OrderTracker(); log = []; t.subscribe(log.append); t.update('packed'); log['packed']
The callback fired on update.
Store callbacks in a list.
Loop and call them inside update.