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:
Looked through the Office.js file and documentation.
Investigated the underlying tech so expected some standard html techniques to work.
Tried both postMessage and using a storage event (which worked in IE directly, but not when in PowerPoint).
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?
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.