@adobe/helix-rum-enhancer 1.10.0 → 1.11.0
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/index.js +10 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.10.0...v1.11.0) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **observer:** enable tracking of JSON loading for all browsers that have a PerformanceObserver implementation ([c049f93](https://github.com/adobe/helix-rum-enhancer/commit/c049f930f0cc1dc548e42bd8e76cd97709a873d7))
|
|
7
|
+
|
|
1
8
|
# [1.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.1...v1.10.0) (2024-01-16)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -137,7 +137,6 @@ sampleRUM.sourceselector = (element) => {
|
|
|
137
137
|
if (Array.from(element.classList).some((className) => className.match(/button|cta/))) {
|
|
138
138
|
return blockName ? `.${blockName} .button` : '.button';
|
|
139
139
|
}
|
|
140
|
-
|
|
141
140
|
return sampleRUM.sourceselector(element.parentElement);
|
|
142
141
|
};
|
|
143
142
|
|
|
@@ -155,15 +154,13 @@ document.querySelectorAll('form').forEach((form) => {
|
|
|
155
154
|
window.addEventListener('visibilitychange', ((event) => sampleRUM.leave(event)));
|
|
156
155
|
window.addEventListener('pagehide', ((event) => sampleRUM.leave(event)));
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
observer.observe({ type: 'resource', buffered: true });
|
|
169
|
-
}
|
|
157
|
+
const observer = new PerformanceObserver((list) => {
|
|
158
|
+
list.getEntries()
|
|
159
|
+
.filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
|
|
160
|
+
.filter((entry) => window.location.hostname === new URL(entry.name).hostname)
|
|
161
|
+
.filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
|
|
162
|
+
.forEach((entry) => {
|
|
163
|
+
sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
observer.observe({ type: 'resource', buffered: true });
|