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

Commit 9bc0682

Browse files
authored
Merge pull request #135 from Zlatkovsky/patch-2
Fix Utilities.host/Utilities.platform
2 parents a7b0282 + 28966a1 commit 9bc0682

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/helpers/utilities.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ function getHostInfo(): {
4545
// when queried from within an add-in.
4646
// If the platform already exposes that info, then just return it
4747
// (but only after massaging it to fit the return types expected by this function)
48-
const context: IContext = ((window as any).Office && (window as any).Office.context) || useHostInfoFallbackLogic();
48+
const Office = (window as any).Office as { context: IContext };
49+
const isHostExposedNatively = Office && Office.context && Office.context.host;
50+
const context: IContext = isHostExposedNatively
51+
? Office.context
52+
: useHostInfoFallbackLogic();
4953
return {
5054
host: convertHostValue(context.host),
5155
platform: convertPlatformValue(context.platform)

0 commit comments

Comments
 (0)