noibu-react-native 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/clientConfig.js +225 -217
- package/dist/api/helpCode.js +61 -87
- package/dist/api/metroplexSocket.js +460 -463
- package/dist/api/storedPageVisit.js +150 -208
- package/dist/constants.js +10 -2
- package/dist/entry/init.js +65 -63
- package/dist/monitors/{appNavigationMonitor.js → AppNavigationMonitor.js} +12 -22
- package/dist/monitors/ClickMonitor.js +198 -0
- package/dist/monitors/ErrorMonitor.js +206 -0
- package/dist/monitors/KeyboardInputMonitor.js +60 -0
- package/dist/monitors/PageMonitor.js +98 -0
- package/dist/monitors/RequestMonitor.js +390 -0
- package/dist/monitors/http-tools/GqlErrorValidator.js +259 -0
- package/dist/monitors/http-tools/HTTPDataBundler.js +458 -0
- package/dist/monitors/integrations/react-native-navigation-integration.js +4 -2
- package/dist/pageVisit/EventDebouncer.js +99 -0
- package/dist/pageVisit/pageVisitEventError.js +2 -2
- package/dist/pageVisit/pageVisitEventHTTP.js +79 -93
- package/dist/react/ErrorBoundary.js +18 -15
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -2
- package/dist/sessionRecorder/sessionRecorder.js +152 -151
- package/dist/{api → src/api}/clientConfig.d.ts +2 -2
- package/dist/{api → src/api}/helpCode.d.ts +10 -16
- package/dist/{api → src/api}/metroplexSocket.d.ts +48 -67
- package/dist/{api → src/api}/storedPageVisit.d.ts +12 -21
- package/dist/{constants.d.ts → src/constants.d.ts} +45 -0
- package/dist/{entry → src/entry}/init.d.ts +1 -1
- package/dist/src/monitors/AppNavigationMonitor.d.ts +18 -0
- package/dist/src/monitors/ClickMonitor.d.ts +31 -0
- package/dist/src/monitors/ErrorMonitor.d.ts +63 -0
- package/dist/{monitors/keyboardInputMonitor.d.ts → src/monitors/KeyboardInputMonitor.d.ts} +7 -4
- package/dist/{monitors/pageMonitor.d.ts → src/monitors/PageMonitor.d.ts} +6 -8
- package/dist/src/monitors/RequestMonitor.d.ts +94 -0
- package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +59 -0
- package/dist/src/monitors/http-tools/HTTPDataBundler.d.ts +112 -0
- package/dist/{monitors → src/monitors}/integrations/react-native-navigation-integration.d.ts +3 -2
- package/dist/src/pageVisit/EventDebouncer.d.ts +24 -0
- package/dist/{pageVisit → src/pageVisit}/pageVisit.d.ts +1 -1
- package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +25 -0
- package/dist/{sessionRecorder → src/sessionRecorder}/types.d.ts +1 -1
- package/dist/{storage → src/storage}/rnStorageProvider.d.ts +1 -1
- package/dist/{storage → src/storage}/storage.d.ts +2 -2
- package/dist/{storage → src/storage}/storageProvider.d.ts +3 -3
- package/dist/{utils → src/utils}/function.d.ts +27 -7
- package/dist/{utils → src/utils}/object.d.ts +11 -8
- package/dist/src/utils/piiRedactor.d.ts +11 -0
- package/dist/src/utils/polyfills.d.ts +4 -0
- package/dist/storage/rnStorageProvider.js +7 -4
- package/dist/storage/storage.js +43 -35
- package/dist/storage/storageProvider.js +23 -19
- package/dist/types/Config.d.ts +24 -20
- package/dist/types/Metroplex.types.d.ts +73 -0
- package/dist/types/Monitor.d.ts +11 -0
- package/dist/types/Monitor.js +19 -0
- package/dist/types/PageVisit.types.d.ts +8 -0
- package/dist/types/PageVisitErrors.types.d.ts +114 -0
- package/dist/types/PageVisitEvents.types.d.ts +91 -0
- package/dist/types/PageVisitMetrics.types.d.ts +27 -0
- package/dist/types/Storage.d.ts +1 -1
- package/dist/types/StoredPageVisit.types.d.ts +4 -47
- package/dist/types/WrappedObjects.d.ts +6 -0
- package/dist/utils/function.js +110 -77
- package/dist/utils/object.js +59 -6
- package/dist/utils/piiRedactor.js +98 -0
- package/dist/utils/polyfills.js +24 -0
- package/package.json +8 -8
- package/dist/monitors/appNavigationMonitor.d.ts +0 -22
- package/dist/monitors/clickMonitor.d.ts +0 -44
- package/dist/monitors/clickMonitor.js +0 -251
- package/dist/monitors/errorMonitor.d.ts +0 -28
- package/dist/monitors/errorMonitor.js +0 -180
- package/dist/monitors/gqlErrorValidator.d.ts +0 -82
- package/dist/monitors/gqlErrorValidator.js +0 -306
- package/dist/monitors/httpDataBundler.d.ts +0 -161
- package/dist/monitors/httpDataBundler.js +0 -725
- package/dist/monitors/inputMonitor.d.ts +0 -34
- package/dist/monitors/inputMonitor.js +0 -138
- package/dist/monitors/keyboardInputMonitor.js +0 -66
- package/dist/monitors/pageMonitor.js +0 -122
- package/dist/monitors/requestMonitor.d.ts +0 -10
- package/dist/monitors/requestMonitor.js +0 -401
- package/dist/pageVisit/pageVisitEventHTTP.d.ts +0 -18
- package/dist/types/PageVisit.d.ts +0 -22
- package/dist/types/ReactNative.d.ts +0 -4
- package/dist/types/globals.d.ts +0 -45
- /package/dist/{api → src/api}/inputManager.d.ts +0 -0
- /package/dist/{api → src/api}/storedMetrics.d.ts +0 -0
- /package/dist/{const_matchers.d.ts → src/const_matchers.d.ts} +0 -0
- /package/dist/{entry → src/entry}/index.d.ts +0 -0
- /package/dist/{pageVisit → src/pageVisit}/pageVisitEventError.d.ts +0 -0
- /package/dist/{pageVisit → src/pageVisit}/userStep.d.ts +0 -0
- /package/dist/{react → src/react}/ErrorBoundary.d.ts +0 -0
- /package/dist/{sessionRecorder → src/sessionRecorder}/nativeSessionRecorderSubscription.d.ts +0 -0
- /package/dist/{sessionRecorder → src/sessionRecorder}/sessionRecorder.d.ts +0 -0
- /package/dist/{utils → src/utils}/date.d.ts +0 -0
- /package/dist/{utils → src/utils}/eventlistener.d.ts +0 -0
- /package/dist/{utils → src/utils}/log.d.ts +0 -0
- /package/dist/{utils → src/utils}/performance.d.ts +0 -0
- /package/dist/{utils → src/utils}/stacktrace-parser.d.ts +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Singleton class to manage the client configuration
|
|
3
|
-
* this class will be responsible for debouncing all events
|
|
4
|
-
* that are registered
|
|
5
|
-
*/
|
|
6
|
-
export class InputMonitor {
|
|
7
|
-
/**
|
|
8
|
-
* gets the instance of InputMonitor
|
|
9
|
-
* @returns {InputMonitor}
|
|
10
|
-
*/
|
|
11
|
-
static getInstance(): InputMonitor;
|
|
12
|
-
eventsToDebounce: {};
|
|
13
|
-
/** will debounce all events that are of this type by the debounce period
|
|
14
|
-
* @param {} type
|
|
15
|
-
* @param {} debouncePeriod
|
|
16
|
-
* @param {} eventName=type
|
|
17
|
-
*/
|
|
18
|
-
registerInputType(type: any, debouncePeriod: any, eventName?: any): void;
|
|
19
|
-
/**
|
|
20
|
-
* Creates an event object with the event and the time it was added then pushes
|
|
21
|
-
* that event object to the queue of events waiting to be debounced.
|
|
22
|
-
* @param {} event
|
|
23
|
-
* @param {} type
|
|
24
|
-
*/
|
|
25
|
-
addEvent(event: any, type: any): void;
|
|
26
|
-
/**
|
|
27
|
-
* Adds the events from the object to the page visit and sets up a timer
|
|
28
|
-
* to send the events if no more are received without the timeout
|
|
29
|
-
* @param {} type
|
|
30
|
-
*/
|
|
31
|
-
_debouncePvEvents(type: any): void;
|
|
32
|
-
/** Sets up the page hide handler to try to push remaining events in the queues */
|
|
33
|
-
_setupUnloadHandler(): void;
|
|
34
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { PageVisit } from '../pageVisit/pageVisit.js';
|
|
2
|
-
import { APP_NAVIGATION_EVENT_TYPE, PAGE_EVENT_TYPE, MAX_TIME_FOR_UNSENT_DATA_MILLIS, ERROR_EVENT_TYPE, HTTP_EVENT_TYPE, KEYBOARD_EVENT_TYPE, USERSTEP_EVENT_TYPE } from '../constants.js';
|
|
3
|
-
import { timestampWrapper } from '../utils/date.js';
|
|
4
|
-
import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
5
|
-
import { noibuLog } from '../utils/log.js';
|
|
6
|
-
|
|
7
|
-
/** @module InputMonitor */
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Singleton class to manage the client configuration
|
|
11
|
-
* this class will be responsible for debouncing all events
|
|
12
|
-
* that are registered
|
|
13
|
-
*/
|
|
14
|
-
class InputMonitor {
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of InputMonitor
|
|
17
|
-
*/
|
|
18
|
-
constructor() {
|
|
19
|
-
// events are stored in queues that are debounced seperatly
|
|
20
|
-
// each object in this map is
|
|
21
|
-
// type: {
|
|
22
|
-
// timeout: timeout,
|
|
23
|
-
// events: [...],
|
|
24
|
-
// debouncePeriod: period at which we debounce events,
|
|
25
|
-
// eventName: name of the event, could be different than type
|
|
26
|
-
// (clicks and keyboards are usersteps)
|
|
27
|
-
// }
|
|
28
|
-
this.eventsToDebounce = {};
|
|
29
|
-
|
|
30
|
-
// setting up debouncers for all events
|
|
31
|
-
// we send clicks directly to the socket so they aren't registered here
|
|
32
|
-
// we dont wait to send location changes, they happen at most once per second.
|
|
33
|
-
this.registerInputType(APP_NAVIGATION_EVENT_TYPE, 0);
|
|
34
|
-
this.registerInputType(PAGE_EVENT_TYPE, MAX_TIME_FOR_UNSENT_DATA_MILLIS);
|
|
35
|
-
this.registerInputType(ERROR_EVENT_TYPE, MAX_TIME_FOR_UNSENT_DATA_MILLIS);
|
|
36
|
-
this.registerInputType(HTTP_EVENT_TYPE, MAX_TIME_FOR_UNSENT_DATA_MILLIS);
|
|
37
|
-
this.registerInputType(
|
|
38
|
-
KEYBOARD_EVENT_TYPE,
|
|
39
|
-
MAX_TIME_FOR_UNSENT_DATA_MILLIS,
|
|
40
|
-
USERSTEP_EVENT_TYPE,
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
this._setupUnloadHandler();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* gets the instance of InputMonitor
|
|
48
|
-
* @returns {InputMonitor}
|
|
49
|
-
*/
|
|
50
|
-
static getInstance() {
|
|
51
|
-
if (!this.instance) {
|
|
52
|
-
this.instance = new InputMonitor();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return this.instance;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** will debounce all events that are of this type by the debounce period
|
|
59
|
-
* @param {} type
|
|
60
|
-
* @param {} debouncePeriod
|
|
61
|
-
* @param {} eventName=type
|
|
62
|
-
*/
|
|
63
|
-
registerInputType(type, debouncePeriod, eventName = type) {
|
|
64
|
-
if (type in this.eventsToDebounce) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// registering this event type as a debouncable
|
|
69
|
-
this.eventsToDebounce[type] = {
|
|
70
|
-
timeout: null,
|
|
71
|
-
events: [],
|
|
72
|
-
debouncePeriod,
|
|
73
|
-
eventName,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Creates an event object with the event and the time it was added then pushes
|
|
79
|
-
* that event object to the queue of events waiting to be debounced.
|
|
80
|
-
* @param {} event
|
|
81
|
-
* @param {} type
|
|
82
|
-
*/
|
|
83
|
-
addEvent(event, type) {
|
|
84
|
-
noibuLog('addEvent', {
|
|
85
|
-
event,
|
|
86
|
-
type,
|
|
87
|
-
});
|
|
88
|
-
if (!(type in this.eventsToDebounce)) {
|
|
89
|
-
throw new Error(`Type: ${type} is not in eventsToDebounce`);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
this.eventsToDebounce[type].events.push({
|
|
93
|
-
event,
|
|
94
|
-
occurredAt: new Date(timestampWrapper(Date.now())).toISOString(),
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
this._debouncePvEvents(type);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Adds the events from the object to the page visit and sets up a timer
|
|
102
|
-
* to send the events if no more are received without the timeout
|
|
103
|
-
* @param {} type
|
|
104
|
-
*/
|
|
105
|
-
_debouncePvEvents(type) {
|
|
106
|
-
/**
|
|
107
|
-
* Debounce function to be executed once the debounce period is completed
|
|
108
|
-
*/
|
|
109
|
-
const later = () => {
|
|
110
|
-
this.eventsToDebounce[type].timeout = null;
|
|
111
|
-
PageVisit.getInstance().addPageVisitEvents(
|
|
112
|
-
this.eventsToDebounce[type].events,
|
|
113
|
-
this.eventsToDebounce[type].eventName,
|
|
114
|
-
);
|
|
115
|
-
this.eventsToDebounce[type].events = [];
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
clearTimeout(this.eventsToDebounce[type].timeout);
|
|
119
|
-
this.eventsToDebounce[type].timeout = setTimeout(
|
|
120
|
-
later,
|
|
121
|
-
this.eventsToDebounce[type].debouncePeriod,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Sets up the page hide handler to try to push remaining events in the queues */
|
|
126
|
-
_setupUnloadHandler() {
|
|
127
|
-
addSafeEventListener(window, 'pagehide', () => {
|
|
128
|
-
Object.values(this.eventsToDebounce).forEach(eventObject => {
|
|
129
|
-
PageVisit.getInstance().addPageVisitEvents(
|
|
130
|
-
eventObject.events,
|
|
131
|
-
eventObject.eventName,
|
|
132
|
-
);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { InputMonitor };
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { TextInput } from 'react-native';
|
|
2
|
-
import { updatePayload } from '../pageVisit/userStep.js';
|
|
3
|
-
import { InputMonitor } from './inputMonitor.js';
|
|
4
|
-
import { SOURCE_ATT_NAME, TEXT_ATT_NAME, TAGNAME_ATT_NAME, TYPE_ATT_NAME, KEYBOARD_EVENT_TYPE } from '../constants.js';
|
|
5
|
-
|
|
6
|
-
/** @module KeyboardInputMonitor */
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* KeyboardInputMonitor is a listener class that attaches a
|
|
10
|
-
* keyboard input listener of the document object.
|
|
11
|
-
*/
|
|
12
|
-
class KeyboardInputMonitor {
|
|
13
|
-
/**
|
|
14
|
-
* Begins the monitoring process
|
|
15
|
-
* we currently only monitor two input locations: textarea and input
|
|
16
|
-
*/
|
|
17
|
-
monitor() {
|
|
18
|
-
const handler = this._handle.bind(this);
|
|
19
|
-
|
|
20
|
-
if (!TextInput.originalRender) {
|
|
21
|
-
TextInput.originalRender = TextInput.render;
|
|
22
|
-
TextInput.render = function (props, ...args) {
|
|
23
|
-
const onChange = event => {
|
|
24
|
-
const currentText = event.nativeEvent.text;
|
|
25
|
-
handler(event.target.viewConfig.uiViewClassName, props);
|
|
26
|
-
if (props.onChange) props.onChange(event);
|
|
27
|
-
if (props.onChangeText) props.onChangeText(currentText);
|
|
28
|
-
};
|
|
29
|
-
const newProps = {
|
|
30
|
-
...props,
|
|
31
|
-
onChange,
|
|
32
|
-
};
|
|
33
|
-
return TextInput.originalRender(newProps, ...args);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Validates an event
|
|
40
|
-
* @param uiViewClassName
|
|
41
|
-
* @param props
|
|
42
|
-
*/
|
|
43
|
-
_handle(uiViewClassName, props) {
|
|
44
|
-
if (!/(text|input)/i.test(uiViewClassName)) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const name = props.placeholder || props.testID;
|
|
49
|
-
|
|
50
|
-
if (!name) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
InputMonitor.getInstance().addEvent(
|
|
55
|
-
updatePayload({
|
|
56
|
-
[SOURCE_ATT_NAME]: '',
|
|
57
|
-
[TEXT_ATT_NAME]: name,
|
|
58
|
-
[TAGNAME_ATT_NAME]: uiViewClassName.toLowerCase(),
|
|
59
|
-
[TYPE_ATT_NAME]: KEYBOARD_EVENT_TYPE,
|
|
60
|
-
}),
|
|
61
|
-
KEYBOARD_EVENT_TYPE,
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { KeyboardInputMonitor };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { PAGE_EVENTS_WINDOW, PAGE_EVENTS_DOCUMENT, PAGE_EVENT_TYPE } from '../constants.js';
|
|
2
|
-
import { InputMonitor } from './inputMonitor.js';
|
|
3
|
-
import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
4
|
-
|
|
5
|
-
/** @module PageMonitor */
|
|
6
|
-
|
|
7
|
-
/** Monitors the page events which we capture and later process */
|
|
8
|
-
class PageMonitor {
|
|
9
|
-
/**
|
|
10
|
-
* gets the singleton instance
|
|
11
|
-
* @returns {PageMonitor}
|
|
12
|
-
*/
|
|
13
|
-
static getInstance() {
|
|
14
|
-
if (!this.instance) {
|
|
15
|
-
this.instance = new PageMonitor();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return this.instance;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Starts monitoring page events on the document */
|
|
22
|
-
monitor() {
|
|
23
|
-
PAGE_EVENTS_WINDOW.forEach(pageEvent => {
|
|
24
|
-
addSafeEventListener(
|
|
25
|
-
window,
|
|
26
|
-
pageEvent,
|
|
27
|
-
this._onPageEventHandle.bind(this),
|
|
28
|
-
true,
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
if (global.document) {
|
|
32
|
-
PAGE_EVENTS_DOCUMENT.forEach(pageEvent => {
|
|
33
|
-
addSafeEventListener(
|
|
34
|
-
document,
|
|
35
|
-
pageEvent,
|
|
36
|
-
this._onPageEventHandle.bind(this),
|
|
37
|
-
true,
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Handles a single page event
|
|
45
|
-
* @param {} event
|
|
46
|
-
*/
|
|
47
|
-
_onPageEventHandle(event) {
|
|
48
|
-
if (!event || !event.type) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const payload = {
|
|
53
|
-
type: event.type,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// Add data if applicable for the event type
|
|
57
|
-
switch (event.type) {
|
|
58
|
-
case 'visibilitychange':
|
|
59
|
-
payload.data = `state: ${this.getDocumentState()}`;
|
|
60
|
-
break;
|
|
61
|
-
case 'readystatechange':
|
|
62
|
-
payload.data = `state: ${document.readyState}`;
|
|
63
|
-
break;
|
|
64
|
-
case 'pagehide':
|
|
65
|
-
case 'pageshow':
|
|
66
|
-
case 'load':
|
|
67
|
-
if (event.persisted) {
|
|
68
|
-
payload.data = `persisted: ${event.persisted}`;
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
case 'storage':
|
|
72
|
-
if (event.key) {
|
|
73
|
-
payload.data = `key: ${event.key}`;
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
case 'message':
|
|
77
|
-
case 'messageerror':
|
|
78
|
-
if (event.data && event.origin) {
|
|
79
|
-
payload.data = `origin: ${event.origin} size: ${this.getSizeInBytes(
|
|
80
|
-
event.data,
|
|
81
|
-
)}`;
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
case 'hashchange':
|
|
85
|
-
if (event.newURL) {
|
|
86
|
-
payload.data = `newURL: ${event.newURL}`;
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
89
|
-
// do nothing
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// storing the page event in the page visit queue
|
|
93
|
-
InputMonitor.getInstance().addEvent(payload, PAGE_EVENT_TYPE);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Returns document state */
|
|
97
|
-
getDocumentState() {
|
|
98
|
-
if (document.visibilityState === 'hidden') {
|
|
99
|
-
return 'hidden';
|
|
100
|
-
}
|
|
101
|
-
if (document.hasFocus()) {
|
|
102
|
-
return 'active';
|
|
103
|
-
}
|
|
104
|
-
return 'passive';
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Returns object size in bytes
|
|
109
|
-
* @param {} obj
|
|
110
|
-
*/
|
|
111
|
-
getSizeInBytes(obj) {
|
|
112
|
-
let str = obj;
|
|
113
|
-
if (typeof obj !== 'string') {
|
|
114
|
-
// Else, make obj into a string
|
|
115
|
-
str = JSON.stringify(obj);
|
|
116
|
-
}
|
|
117
|
-
// 2B per character in the string
|
|
118
|
-
return str.length * 2;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export { PageMonitor };
|