OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
674 stars 95 forks source link

Office.onReady results don't match documentation #306

Closed sureshjoshi closed 5 years ago

sureshjoshi commented 5 years ago

Expected Behavior

According to the Office.onReady Typescript documentation "...it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform."

Thus, I am expecting both host and platform to be null when opening my app in the browser, inside onReady.

Current Behavior

Reading the host/application after Office.onReady after launching an application in the browser shows: Host: "Excel" Platform: "PC"

This is especially weird given I'm on a Mac. As a workaround, I use if (!isEmpty(Office.context)) to check if I'm in or out of Word.

Steps to Reproduce, or Live Example

Office.onReady()
    .then((info): any => {
        console.log(info.host, info.platform);
});

Office.onReady((info: any) => {
    console.log(info.host, info.platform);
});

Context

I'm trying to do some basic UI testing with VS Code debugging, and also run an addin in Word without needing to recompile.

Your Environment

JuaneloJuanelo commented 5 years ago

this is a known issue and we are working to update our JS CDN soon with a fix. thanks!

JuaneloJuanelo commented 5 years ago

this is duplicate of this issue, so closing this one as such.. https://github.com/OfficeDev/office-js/issues/301