gsklee/ngStorage — pull request #47 by dpogue (2014-05-17 19:28:10+00:00)
Title: Catch against IE's broken storage events

Only deal with storage events that come while the document is not in focus.
See also: http://stackoverflow.com/questions/18476564/ie-localstorage-event-misfired

This caused us some problems when we were making multiple writes to localStorage and seeing data get overwritten with old values or disappear entirely:

1. Assign stuff to $localStorage.
2. $localStorage debounce happens and writes it to browser localStorage.
3. Assign more stuff to $localStorage.
4. IE fires to storage event, we update $localStorage and overwrite our changes from step 3.
5. $localStorage debounce happens and detects no changes because they were overwritten.