Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isBackgroundLoad property on page context #2286

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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