move all events to an enum and update guide

This commit is contained in:
Yanzhen Yu
2019-01-25 17:18:51 +08:00
parent 079880be1e
commit 6abf4fd4a0
4 changed files with 55 additions and 9 deletions

View File

@@ -249,6 +249,25 @@ new rrwebPlayer({
});
```
#### Events
Developers may want to extend the rrweb's replayer or respond to its events. Such as giving a notification when the replayer starts to skip inactive time.
So rrweb expose a public API `on` which allow developers listen to the events and customize the reactions, and it has the following events:
| event | description |
| ---------------------- | ---------------------------------- |
| start | started to replay |
| pause | paused the replay |
| resume | resumed the replay |
| finish | finished the replay |
| fullsnapshot-rebuilded | rebuilded a full snapshot |
| load-stylesheet-start | started to load remote stylesheets |
| load-stylesheet-end | loaded remote stylesheets |
| skip-start | started to skip inactive time |
| skip-end | skipped inactive time |
The rrweb-replayer also re-expose the event listener via a `component.addEventListener` API.
## API
### rrweb