update Chinese guide doc
This commit is contained in:
7
guide.md
7
guide.md
@@ -58,17 +58,18 @@ rrweb.record({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
During recording, the recorder will emit when there is some event incurred, all you need to do is to store the emitted events in any way you like.
|
During recording, the recorder will emit when there is some event incurred, all you need to do is to store the emitted events in any way you like.
|
||||||
|
|
||||||
The `record` method returns a function which can be called to stop events from firing:
|
The `record` method returns a function which can be called to stop events from firing:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let stopFn = rrweb.record({
|
let stopFn = rrweb.record({
|
||||||
emit(event) {
|
emit(event) {
|
||||||
if(events.length > 100){ //stop after 100 events
|
if (events.length > 100) {
|
||||||
|
// stop after 100 events
|
||||||
stopFn();
|
stopFn();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,19 @@ rrweb.record({
|
|||||||
|
|
||||||
rweb 在录制时会不断将各类 event 传递给配置的 emit 方法,你可以使用任何方式存储这些 event 以便之后回放。
|
rweb 在录制时会不断将各类 event 传递给配置的 emit 方法,你可以使用任何方式存储这些 event 以便之后回放。
|
||||||
|
|
||||||
|
调用 `record` 方法将返回一个函数,调用该函数可以终止录制:
|
||||||
|
|
||||||
|
```js
|
||||||
|
let stopFn = rrweb.record({
|
||||||
|
emit(event) {
|
||||||
|
if (events.length > 100) {
|
||||||
|
// 当事件数量大于 100 时停止录制
|
||||||
|
stopFn();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
一个更接近实际真实使用场景的示例如下:
|
一个更接近实际真实使用场景的示例如下:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@@ -117,12 +130,12 @@ replayer.play();
|
|||||||
|
|
||||||
可以通过 `new rrweb.Replayer(events, options)` 的方式向 rrweb 传递回放时的配置参数,具体配置如下:
|
可以通过 `new rrweb.Replayer(events, options)` 的方式向 rrweb 传递回放时的配置参数,具体配置如下:
|
||||||
|
|
||||||
| key | 默认值 | 功能 |
|
| key | 默认值 | 功能 |
|
||||||
| ----- | ------------- | -------- |
|
| ------------ | ------------- | ---------------------------- |
|
||||||
| speed | 1 | 回放倍速 |
|
| speed | 1 | 回放倍速 |
|
||||||
| root | document.body | 回放时使用的 HTML 元素 |
|
| root | document.body | 回放时使用的 HTML 元素 |
|
||||||
| loadTimeout | 0 | 加载异步样式表的超时时长 |
|
| loadTimeout | 0 | 加载异步样式表的超时时长 |
|
||||||
| skipInactive | false | 是否快速跳过无用户操作的阶段 |
|
| skipInactive | false | 是否快速跳过无用户操作的阶段 |
|
||||||
|
|
||||||
#### 使用 rrweb-player
|
#### 使用 rrweb-player
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user