Skip to content

Commit

Permalink
update Chinese guide doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyz0112 committed Dec 31, 2018
1 parent d25a96e commit 96bb177
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
7 changes: 4 additions & 3 deletions guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```js
let stopFn = rrweb.record({
emit(event) {
if(events.length > 100){ //stop after 100 events
if (events.length > 100) {
// stop after 100 events
stopFn();
}
}
},
});
```

Expand Down
25 changes: 19 additions & 6 deletions guide.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ rrweb.record({

rweb 在录制时会不断将各类 event 传递给配置的 emit 方法,你可以使用任何方式存储这些 event 以便之后回放。

调用 `record` 方法将返回一个函数,调用该函数可以终止录制:

```js
let stopFn = rrweb.record({
emit(event) {
if (events.length > 100) {
// 当事件数量大于 100 时停止录制
stopFn();
}
},
});
```

一个更接近实际真实使用场景的示例如下:

```js
Expand Down Expand Up @@ -117,12 +130,12 @@ replayer.play();

可以通过 `new rrweb.Replayer(events, options)` 的方式向 rrweb 传递回放时的配置参数,具体配置如下:

| key | 默认值 | 功能 |
| ----- | ------------- | -------- |
| speed | 1 | 回放倍速 |
| root | document.body | 回放时使用的 HTML 元素 |
| loadTimeout | 0 | 加载异步样式表的超时时长 |
| skipInactive | false | 是否快速跳过无用户操作的阶段 |
| key | 默认值 | 功能 |
| ------------ | ------------- | ---------------------------- |
| speed | 1 | 回放倍速 |
| root | document.body | 回放时使用的 HTML 元素 |
| loadTimeout | 0 | 加载异步样式表的超时时长 |
| skipInactive | false | 是否快速跳过无用户操作的阶段 |

#### 使用 rrweb-player

Expand Down

0 comments on commit 96bb177

Please sign in to comment.