Adds on and trigger APIs.
Adds a run loop.