Use MutationObserver where possible, otherwise ensure flushing with setTimeout

- Use `MutationObserver` where possible (fixes #1)
- Otherwise, ensure flushing with `setTimeout` (fixes #21)

I decided for now to keep `setImmediate` and `MessageChannel` to maintain performances in workers.