mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

allow callback in time_event to modify tracked time

Open subvertallchris opened this issue 6 years ago • 3 comments

As suggested in #204, here's a first stab at adding a callback to time_event so one can see or manipulate the tracked time. I'm not sure of the standards and best practices that you guys follow so I used my best judgment. I'm not stoked about adding the EVENT_TIMERS_KEY_CALLBACK constant but I wasn't sure where to stash it and figured it'd be best to just ask for forgiveness than permission... I added one test, too. Happy to modify this however you'd like.

subvertallchris avatar Jan 17 '19 20:01 subvertallchris

@tdumitrescu

subvertallchris avatar Jan 17 '19 20:01 subvertallchris

@tdumitrescu, I've updated this as suggested in your comment. I also added a test to demonstrate that it correctly removes the callback after it is fired. I'm not totally sure about whether I handled storing it on the instance correctly. It doesn't feel right to introduce a new key right on the instance but I couldn't find a really clear example of something similar happening, so let me know if I should handle it differently.

I'll squash these down to one commit if we can get this approved, I'm just leaving them as independent commits for now so we can see the feature's genesis.

subvertallchris avatar Jan 18 '19 15:01 subvertallchris

Just checking in here. Any thoughts?

subvertallchris avatar Feb 20 '19 15:02 subvertallchris