Skip to content

Instantly share code, notes, and snippets.

@YonathanMeguira
Created December 24, 2020 14:03
Show Gist options
  • Save YonathanMeguira/0b8b95b212d0c6fe4300fe83550132cb to your computer and use it in GitHub Desktop.
Save YonathanMeguira/0b8b95b212d0c6fe4300fe83550132cb to your computer and use it in GitHub Desktop.
const event = fromEvent(window, 'storage || onStorage')
.pipe(filter((values: any[]) => // get right key, filter);
// returns the value of amplitude in local storage
event.pipe(pairwise(), take(1)).subscribe(([prev, curr]) => {
if (prev && !curr) {
// amplitude just sent all the events
sendEventsFromSession()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment