-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
769 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
### PageSpy#pagespy | ||
|
||
> The instance variable is named `$pageSpy = new PageSpy(...)`; | ||
- [constructor()](./pagespy#constructor) | ||
- [$pageSpy.updateRoomInfo()](./pagespy#updateRoomInfo) | ||
- [$pageSpy.abort()](./pagespy#abort) | ||
- [PageSpy.registerPlugin()](./pagespy#registerPlugin) | ||
- [PageSpy.pluginsWithOrder](./pagespy#pluginsWithOrder) | ||
- [$pageSpy.version](./pagespy#version) | ||
- [$pageSpy.config](./pagespy#config) | ||
- [$pageSpy.socketStore](./pagespy#socketStore) | ||
|
||
### Plugins#plugins | ||
|
||
#### DataHarborPlugin#harbor | ||
|
||
> The instance variable is named `$harbor = new DataHarborPlugin(...)`; | ||
- [constructor()](./data-harbor#constructor) | ||
- [$harbor.onOfflineLog()](./data-harbor#onOfflineLog) | ||
|
||
#### RRWebPlugin#rrweb | ||
|
||
> The instance variable is named `$rrweb = new RRWebPlugin(...)`; | ||
- [constructor()](./rrweb#constructor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
### PageSpy#pagespy | ||
|
||
> 约定实例变量名称为 `$pageSpy = new PageSpy(...)`; | ||
- [constructor()](./pagespy#constructor) | ||
- [$pageSpy.updateRoomInfo()](./pagespy#updateRoomInfo) | ||
- [$pageSpy.abort()](./pagespy#abort) | ||
- [PageSpy.registerPlugin()](./pagespy#registerPlugin) | ||
- [PageSpy.pluginsWithOrder](./pagespy#pluginsWithOrder) | ||
- [$pageSpy.version](./pagespy#version) | ||
- [$pageSpy.config](./pagespy#config) | ||
- [$pageSpy.socketStore](./pagespy#socketStore) | ||
|
||
### 插件#plugins | ||
|
||
#### DataHarborPlugin#harbor | ||
|
||
> 约定实例变量名称为 `$harbor = new DataHarborPlugin(...)`; | ||
- [constructor()](./data-harbor#constructor) | ||
- [$harbor.onOfflineLog()](./data-harbor#onOfflineLog) | ||
|
||
#### RRWebPlugin#rrweb | ||
|
||
> 约定实例变量名称为 `$rrweb = new RRWebPlugin(...)`; | ||
- [constructor()](./rrweb#constructor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
## DataHarborPlugin API#api | ||
|
||
#### constructor()#constructor | ||
|
||
- Type | ||
|
||
```ts | ||
interface DataHarborConfig { | ||
// Specify the maximum bytes of offline log in memory. | ||
// Default 10MB. | ||
maximum?: number; | ||
|
||
// Specit which types of data to cache | ||
caredData?: Record<DataType, boolean>; | ||
|
||
// Specify the offline log filename, with the default being named according to the current time | ||
filename?: () => string; | ||
|
||
// Custom the behavior of download | ||
onDownload?: (data: CacheMessageItem[]) => void; | ||
} | ||
|
||
delcare class DataHarborPlugin implements PageSpyPlugin { | ||
constructor(config?: DataHarborConfig); | ||
} | ||
``` | ||
|
||
#### onOfflineLog()#onOfflineLog | ||
|
||
Upload / download log manaually. | ||
|
||
- Type | ||
|
||
```ts | ||
declare class DataHarborPlugin { | ||
onOfflineLog(type: 'download' | 'upload'): Promise<string | null | undefined>; | ||
} | ||
``` | ||
|
||
- Details | ||
|
||
If you hide the automatically rendered floating or want to automatically trigger offline log operations at certain times, you can achieve through this method. | ||
|
||
Each invocation logs the entire current session. Once the upload is complete, a replay URL will be returned. | ||
|
||
- Example | ||
|
||
```ts | ||
window.$harbor = new DataHarborPlugin(); | ||
// upload | ||
const url = await window.$harbor.onOfflineLog('upload'); | ||
// download | ||
window.$harbor.onOfflineLog('download'); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
## DataHarborPlugin API#api | ||
|
||
#### constructor()#constructor | ||
|
||
- 类型 | ||
|
||
```ts | ||
interface DataHarborConfig { | ||
// 离线日志数据会优先记录在内存中,当体积达到多大时写入临时文件 | ||
// 默认 10M (10 * 1024 * 1024) | ||
maximum?: number; | ||
|
||
// 指定缓存哪些类型的数据 | ||
caredData?: Record<DataType, boolean>; | ||
|
||
// 指定离线日志文件名,默认是根据当前时间命名 | ||
filename?: () => string; | ||
|
||
// 自定义下载逻辑 | ||
onDownload?: (data: CacheMessageItem[]) => void; | ||
} | ||
|
||
delcare class DataHarborPlugin implements PageSpyPlugin { | ||
constructor(config?: DataHarborConfig); | ||
} | ||
``` | ||
|
||
|
||
|
||
#### onOfflineLog()#onOfflineLog | ||
|
||
手动操作离线日志的下载、上传。 | ||
|
||
- 类型 | ||
|
||
```ts | ||
declare class DataHarborPlugin { | ||
onOfflineLog(type: 'download' | 'upload'): Promise<string | null | undefined>; | ||
} | ||
``` | ||
|
||
- 详细信息 | ||
|
||
如果隐藏了自动渲染的 UI 控件,或者希望在某些时候自动触发队离线日志的操作,可以通过该方法实现。 | ||
|
||
每次调用都是当前会话的完整日志。上传完成后会返回回放的 URL,并打印到控制台。 | ||
|
||
- 示例 | ||
|
||
```ts | ||
window.$harbor = new DataHarborPlugin(); | ||
// 上传 | ||
const url = await window.$harbor.onOfflineLog('upload'); | ||
// 下载 | ||
window.$harbor.onOfflineLog('download'); | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.