Call nextTick instead of setImmediate
Merge pull request #1 from launchdarkly/jko/record-events

Jko/record events
Merge branch 'master' into jko/json-custom
Simplify conditional logic a bit.