Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhike-team/sa-hoc-wrapper
https://github.com/zhike-team/sa-hoc-wrapper
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zhike-team/sa-hoc-wrapper
- Owner: zhike-team
- Created: 2020-05-09T07:39:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T17:59:58.000Z (about 2 years ago)
- Last Synced: 2024-12-22T15:48:02.175Z (about 1 month ago)
- Language: JavaScript
- Size: 666 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SA-HOC-WRAPPER
基于神策的业务高阶组件
暂时只在题库项目中使用## 使用
```shell
npm i @zhike/sa-hoc-wrapper
``````js
import { saWrapper } from '@zhike/sa-hoc-wrapper';@saWrapper({
eventName: 'ti-practice-ielts'
})
class extends Component{
getTrackTimerProperties(){
return {
name: '测试',
}
}
}```
## 开发指南
```shell
# 开启服务
npm start# 编译打包
npm run build# 更新版本号
npm version major|minor|patch
# 发布
npm publish --access public
```## API
配置参数
``` json
{
"eventName": "ti-practice-ielts",
"durationType": "min",
}
``````js
// 返回神策打点属性
getTrackTimerProperties(){
return {
name: '1',
age: '18',
}
}
```默认会将当前包裹组件的 componentDidmount 和 compoentwillunmount 之间的时间 duration 自动上传