Skip to content

Commit

Permalink
Remove the feature flag from the foreground periods
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibautGeriz committed Sep 15, 2021
1 parent 844bbcb commit d726c18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/rum-core/src/boot/startRum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function startRumEventCollection(
getCommonContext: () => CommonContext
) {
const parentContexts = startParentContexts(lifeCycle, session)
const foregroundContexts = startForegroundContexts(configuration)
const foregroundContexts = startForegroundContexts()
const batch = startRumBatch(configuration, lifeCycle)

startRumAssembly(applicationId, configuration, lifeCycle, session, parentContexts, getCommonContext)
Expand Down
5 changes: 2 additions & 3 deletions packages/rum-core/src/domain/foregroundContexts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ describe('foreground context', () => {
beforeEach(() => {
setupBuilder = setup()
.withFakeClock()
.withConfiguration({ isEnabled: () => true })
.beforeBuild(({ configuration }) => {
foregroundContext = startForegroundContexts(configuration)
.beforeBuild(() => {
foregroundContext = startForegroundContexts()
return foregroundContext
})
})
Expand Down
12 changes: 1 addition & 11 deletions packages/rum-core/src/domain/foregroundContexts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
Configuration,
noop,
addEventListener,
DOM_EVENT,
RelativeTime,
Expand Down Expand Up @@ -29,15 +27,7 @@ export interface ForegroundPeriod {

let foregroundPeriods: ForegroundPeriod[] = []

export function startForegroundContexts(configuration: Configuration): ForegroundContexts {
if (!configuration.isEnabled('track-foreground')) {
return {
isInForegroundAt: () => undefined,
selectInForegroundPeriodsFor: () => undefined,
stop: noop,
}
}

export function startForegroundContexts(): ForegroundContexts {
if (document.hasFocus()) {
addNewForegroundPeriod()
}
Expand Down

0 comments on commit d726c18

Please sign in to comment.