Skip to content

Commit

Permalink
Add isBackgroundLoad property on page context (#2286)
Browse files Browse the repository at this point in the history
* Add isBackgroundLoad for pageInfo context

* Added isBackgroundLoad property under page for app context.

The property indicates that the app is loading in the background as part
of an opt-in performance enhancement.

---------

Co-authored-by: jadahiya-MSFT <95651173+jadahiya-MSFT@users.noreply.github.com>
  • Loading branch information
ht4963-ms and jadahiya-MSFT committed May 16, 2024
1 parent bb91b6b commit e59a8a2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added a new page property (isBackgroundLoad) for app context. This will be an indicator that the app is being loaded in the background.",
"packageName": "@microsoft/teams-js",
"email": "helentsang@microsoft.com",
"dependentChangeType": "patch"
}
7 changes: 7 additions & 0 deletions packages/teams-js/src/public/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ export namespace app {
*/
isMultiWindow?: boolean;

/**
* Indicates whether the page is being loaded in the background as
* part of an opt-in performance enhancement.
*/
isBackgroundLoad?: boolean;

/**
* Source origin from where the page is opened
*/
Expand Down Expand Up @@ -985,6 +991,7 @@ function transformLegacyContextToAppContext(legacyContext: LegacyContext): app.C
subPageId: legacyContext.subEntityId,
isFullScreen: legacyContext.isFullScreen,
isMultiWindow: legacyContext.isMultiWindow,
isBackgroundLoad: legacyContext.isBackgroundLoad,
sourceOrigin: legacyContext.sourceOrigin,
},
user: {
Expand Down
8 changes: 8 additions & 0 deletions packages/teams-js/src/public/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,14 @@ export interface Context {
*/
isMultiWindow?: boolean;

/**
* @deprecated
* As of 2.0.0, please use {@link app.PageInfo.isBackgroundLoad | app.Context.page.isBackgroundLoad} instead
*
* Indication whether the tab is being loaded in the background
*/
isBackgroundLoad?: boolean;

/**
* @deprecated
* As of 2.0.0, please use {@link app.AppInfo.iconPositionVertical | app.Context.app.iconPositionVertical} instead
Expand Down
2 changes: 2 additions & 0 deletions packages/teams-js/test/public/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ describe('Testing app capability', () => {
userClickTime: 2222,
userFileOpenPreference: FileOpenPreference.Inline,
isMultiWindow: true,
isBackgroundLoad: true,
frameContext: context,
appLaunchId: 'appLaunchId',
userDisplayName: 'someTestUser',
Expand Down Expand Up @@ -585,6 +586,7 @@ describe('Testing app capability', () => {
sourceOrigin: 'www.origin.com',
frameContext: context,
isMultiWindow: true,
isBackgroundLoad: true,
},
user: {
id: 'someUserObjectId',
Expand Down

0 comments on commit e59a8a2

Please sign in to comment.