简体   繁体   中英

Office365 Addins - How to communicate between addin Windows

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. Eg 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?

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.

遍历文档,似乎可以使用refreshAsync实现这种事情。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM