Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #135 from Zlatkovsky/patch-2
Browse files Browse the repository at this point in the history
Fix Utilities.host/Utilities.platform
  • Loading branch information
akrantz authored May 6, 2019
2 parents a7b0282 + 28966a1 commit 9bc0682
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/helpers/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ function getHostInfo(): {
// when queried from within an add-in.
// If the platform already exposes that info, then just return it
// (but only after massaging it to fit the return types expected by this function)
const context: IContext = ((window as any).Office && (window as any).Office.context) || useHostInfoFallbackLogic();
const Office = (window as any).Office as { context: IContext };
const isHostExposedNatively = Office && Office.context && Office.context.host;
const context: IContext = isHostExposedNatively
? Office.context
: useHostInfoFallbackLogic();
return {
host: convertHostValue(context.host),
platform: convertPlatformValue(context.platform)
Expand Down

0 comments on commit 9bc0682

Please sign in to comment.