I am developing a Word 2016 Addin and I have received an error from a client (logged via Sentry) that I'm having trouble reproducing. It occurred in a Dialog window on macOS Sierra 10.12.6 in Word 16.11.
window.external.RegisterEvent is not a function.
(In 'window.external.RegisterEvent(n,t,i,r)', 'window.external.RegisterEvent' is undefined)
The error originated from the word API script https://appsforoffice.microsoft.com/lib/1/hosted/word-mac-16.00.js
and looking at the debug code on Github, it appears to be coming from this line.
Does anyone have any insight into why this may be occurring? It hasn't happened on any other platform and I'm having trouble reproducing it locally.
Thanks in advance. I'm happy to provide more information if required.
NOTE: This error occurred during the Addin submission review process causing a failed submission - hence the need to track down the source.
I reported this issue here https://github.com/OfficeDev/office-js/issues/97 which was related to the dialog API. Seems that window.external.registerEvent is missing in the dialog on Mac. I could fix it with the following hack which should be called after office.js. Maybe you have the same problem.
const isMac = !!navigator.platform &&
navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (isMac && window.external && !window.external.RegisterEvent) {
window.external.RegisterEvent = () => { };
}