How does StorageEvent work in Office Add-in?

130 Views Asked by At

I have 2 task panes in Word Add-in (using Office UI Fabric with React). I select item in first pane and then I write item's id to localStorage. In the second pane I press update button, so I can see details of the item.

I want to avoid pressing update button. So I tried adding window.addEventListener('storage', f) in the second pane, but it doesn't trigger.

Am I doing something wrong?
or
Does Add-in interpret itself as single window and that's why StorageEvent is not triggered?

And what alternatives do I have?
(Office.context.document.settings, SharedWorker, ...?)

1

There are 1 best solutions below

1
On BEST ANSWER

I've consulted with the Office product team. Their experience is that the storage event does not fire reliably in add-ins, and that this is probably a problem with IE. They recommend that you poll local storage instead of relying on the event.