Using the Trackable Monad

This is the Trackable class from my article on building a monad. Use map to change its value while keeping queued analytics events. Use flatMap when the next function returns another Trackable. Pick an example, edit the TypeScript, then run it to see the value and events.

Build a chain

Change a number and queue one event.

Hover over a method to inspect its types. Edit the chain, helpers, or event data, then run the code.

Loading TypeScript editor…

Diagnostics

0

No issues reported.

Trackable state

Run the code to inspect its value and events.