Document the convenience function `measure`

[doc only]
This commit is contained in:
Jan-Erik Rediger 2021-03-22 14:14:32 +01:00
Родитель 46e90a97ac
Коммит 36207f27e8
2 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -57,6 +57,14 @@ fun onLoginCancel() {
}
```
For convenience one can measure the time of a function or block of code:
```Kotlin
Auth.loginTime.measure {
// Process login flow
}
```
The time reported in the telemetry ping will be timespan recorded during the lifetime of the ping.
There are test APIs available too:
@ -136,6 +144,14 @@ func onLoginCancel() {
}
```
For convenience one can measure the time of a function or block of code:
```Kotlin
Auth.loginTime.measure {
// Process login flow
}
```
The time reported in the telemetry ping will be timespan recorded during the lifetime of the ping.
There are test APIs available too:

Просмотреть файл

@ -69,6 +69,14 @@ fun onPageLoaded(e: Event) {
}
```
For convenience one can measure the time of a function or block of code:
```Kotlin
Pages.pageLoad.measure {
// Load a page
}
```
There are test APIs available too. For convenience, properties `sum` and `count` are exposed to facilitate validating that data was recorded correctly.
Continuing the `pageLoad` example above, at this point the metric should have a `sum == 11` and a `count == 2`:
@ -152,6 +160,15 @@ func onPageLoaded() {
}
```
For convenience one can measure the time of a function or block of code:
```Swift
Pages.pageLoad.measure {
// Load a page
}
```
There are test APIs available too. For convenience, properties `sum` and `count` are exposed to facilitate validating that data was recorded correctly.
Continuing the `pageLoad` example above, at this point the metric should have a `sum == 11` and a `count == 2`: