Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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