Observe
React to FS events by invoking callbacks.
Parameters
type string required
Possible values: start
, shutdown
start
- Callback will be executed after the Fullstory client API is fully initialized and ready to capture. Callback will be executed upon invocation if capture has already started.
shutdown
- Callback will be executed after data capture has shutdown manually using FS('shutdown')
or in response to an api signal that capture should be disabled.
callback object required
A function that will be executed when the event type
is triggered.
Asynchronous Method
The asynchronous version, FS('observeAsync')
, can be used to resolve to an object that can be used to "disconnect" the observer.
FS('observe', { type, callback })
Example Invocation
Get session URL after data capture has started
FS('observe', {
type: 'start',
callback: () => {
const sessionURL = FS('getSession');
// Do stuff with session URL...
}
})
Disconnect callback
const observer = await FS('observeAsync', {
type: 'start',
callback: () => {
console.log('started');
}
});
observer.disconnect();