Office365 Addins - How to communicate between addin Windows

233 Views Asked by At

I am working on an Office365 Javascript Content Addin for PowerPoint and am having trouble with messaging.

Unlike Word or Excel, it is likely multiple Add-ins will be used in one document. E.g. One on slide 3, one on slide 5.

I have 2 scenarios that are not working nicely.

  • Using the Office365 webclient (works fine in native) - if something is changed in slideshow mode, this is not automatically reflected when returning to that slide in designer mode.
  • Webclient and native - If a user logs out on one slide, I cannot get the add-ins on other slides to automatically log out as well.

What I've tried so far:

I could impement a heartbeat or websockets, but would rather avoid hitting the server unnecessarily and and would like to keep things as simple as possible. Alternatively, I could put something in localstorage and use setInterval to check it, but that would add unnecessary background work and slow the application down.

Are there any 'good' ways of solving the above mentioned problems, or is the setInterval/localstorage check the only simple solution at the moment?

2

There are 2 best solutions below

3
On

You could try using the document.settings property instead of localStorage. There is a settingsChanged event that might help you do what you're looking for. I've never used it before so let us know if it helps (or not).

The settingsChanged event is only available for Excel as of this post date.

0
On

Trawling through the documentation, it seems this sort of thing can be achieved using refreshAsync.