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
@@ -24,12 +24,12 @@ UXM is a modular library that allows to combine various functions and collect th
24
24
* Collect RUM data.
25
25
* Build private version of [Chrome User Experience Report](https://developers.google.com/web/tools/chrome-user-experience-report/).
26
26
* Audit the page performance using Puppeteer ([example](./test/index.js)).
27
-
* Dynamically evaluate performance of the user's browser and adapt your app.
27
+
* Dynamically evaluate the performance of the user's device and adapt the UI.
28
28
29
29
**Features**:
30
30
31
31
* Modular design based on ES modules.
32
-
* Small size (1kb gzip). It's usually smaller, if you remove unused functions using[Tree Shaking](https://webpack.js.org/guides/tree-shaking/).
32
+
* Small size (1kb gzip). It's usually smaller if you use[Tree Shaking](https://webpack.js.org/guides/tree-shaking/).
33
33
* Graceful support of latest browser APIs like [Performance Paint Timing](https://developer.mozilla.org/en-US/docs/Web/API/PerformancePaintTiming), [Network Information](https://wicg.github.io/netinfo/), or [Device Memory](https://w3c.github.io/device-memory/).
34
34
* Fully featured [User Timing API](https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API) support.
35
35
* Lightweight device type parser.
@@ -44,12 +44,13 @@ yarn add uxm
44
44
npm i -S uxm
45
45
```
46
46
47
-
Import `uxm` and call it in the end of the page loading to collect [CrUXlike data](https://developers.google.com/web/tools/chrome-user-experience-report/):
47
+
Import `uxm` and call it at the end of the page loading to collect [CrUX-like data](https://developers.google.com/web/tools/chrome-user-experience-report/):
48
48
49
49
```js
50
50
import { uxm } from'uxm'
51
51
52
52
uxm().then(metrics=> {
53
+
console.log(metrics) // ->
53
54
{
54
55
"deviceType":"desktop",
55
56
"effectiveConnectionType":"4g",
@@ -61,7 +62,7 @@ uxm().then(metrics => {
61
62
})
62
63
```
63
64
64
-
Collect just 2 performance metrics associated with `url`:
65
+
Or collect 2 performance metrics associated with URL:
An API is designed in the way that you can combine different functions and collect the data you need.
91
+
An API is a set of pure functions with one exception to `uxm`,
92
+
which is a meta-function to collect multiple metrics at once.
91
93
92
94
### uxm(opts = {})
93
95
94
-
Returns a `Promise` that resolves after `onLoad` event triggered.
96
+
Returns a Promise that resolves after `load` event fired.
95
97
A default set of metrics is defined by [Chrome User Experience Report](https://developers.google.com/web/tools/chrome-user-experience-report/), but you can customize them using options (`url`, `userAgent`, `deviceMemory`, `userTiming`, `longTasks`, `resources`).
Create [User Timing](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark)mark to mark important loading event. Convenient shortcut for `window.performance.mark`.
148
+
Create [User Timing mark](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) to mark important loading event. A convenient shortcut for `window.performance.mark`.
146
149
147
150
```js
148
151
import { mark } from'uxm'
@@ -156,8 +159,8 @@ mark('page fully loaded')
156
159
157
160
### measure(measureName, [startMarkName])
158
161
159
-
Create [User Timing](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) measure to evaluate timing between 2 marks.
160
-
Convenient shortcut for `window.performance.measure`.
162
+
Create [User Timing measure](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) to evaluate timing between 2 marks.
163
+
A convenient shortcut for `window.performance.measure`.
0 commit comments