You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -142,9 +144,10 @@ export class Aggregate extends AggregateBase {
142
144
* Evaluate entitlements and sampling before starting feature mechanics, importing and configuring recording library, and setting storage state
143
145
* @param {boolean} srMode - the true/false state of the "sr" flag (aka. entitlements) from RUM response
144
146
* @param {boolean} ignoreSession - whether to force the method to ignore the session state and use just the sample flags
147
+
* @param {TRIGGERS} [trigger=TRIGGERS.INITIALIZE] - the trigger that initiated the recording. Usually TRIGGERS.INITIALIZE, but could be TRIGGERS.API since in certain cases that trigger calls this method
Copy file name to clipboardExpand all lines: src/features/session_replay/instrument/index.js
+39-40Lines changed: 39 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,11 @@ import { setupPauseReplayAPI } from '../../../loaders/api/pauseReplay'
16
16
17
17
exportclassInstrumentextendsInstrumentBase{
18
18
staticfeatureName=FEATURE_NAME
19
+
/** @type {Promise|undefined} A promise that resolves when the recorder module is imported and added to the class. Undefined if the recorder has never been staged to import with `importRecorder`. */
20
+
#stagedImport
21
+
/** The RRWEB recorder instance, if imported */
22
+
recorder
19
23
20
-
#mode
21
-
#agentRef
22
24
constructor(agentRef){
23
25
super(agentRef,FEATURE_NAME)
24
26
@@ -27,7 +29,6 @@ export class Instrument extends InstrumentBase {
@@ -57,54 +60,50 @@ export class Instrument extends InstrumentBase {
57
60
if(!session){// this might be a new session if entity initializes: conservatively start recording if first-time config allows
58
61
// Note: users with SR enabled, as well as these other configs enabled by-default, will be penalized by the recorder overhead EVEN IF they don't actually have or get
59
62
// entitlement or sampling decision, or otherwise intentionally opted-in for the feature.
returntrue// existing sessions get to continue recording, regardless of this page's configs or if it has expired (conservatively)
63
66
}else{// SR mode was OFF but may potentially be turned on if session resets and configs allows the new session to have replay...
64
-
returnisPreloadAllowed(this.#agentRef.init)
67
+
returnisPreloadAllowed(this.agentRef.init)
65
68
}
66
69
}
67
70
68
-
#alreadyStarted =false
69
71
/**
70
-
* This func is use for early pre-load recording prior to replay feature (agg) being loaded onto the page. It should only setup once, including if already called and in-progress.
72
+
* Returns a promise that imports the recorder module. Only lets the recorder module be imported and instantiated once. Rejects if failed to import/instantiate.
// If startReplay() has been used by this point, we must record in full mode regardless of session preload:
80
-
// Note: recorder starts here with w/e the mode is at this time, but this may be changed later (see #apiStartOrRestartReplay else-case)
81
-
this.recorder??=newRecorder({ ...this,mode: this.#mode,agentRef: this.#agentRef, trigger,timeKeeper: this.#agentRef.runtime.timeKeeper})// if TK exists due to deferred state, pass it
0 commit comments