1.0.7 • Published 1 month ago

@easycode/client-detector v1.0.7

Weekly downloads
-
License
-
Repository
-
Last release
1 month ago

介绍

功能

设备信息搜集

错误日志

未完成

性能数据

未完成

安装

npm install @easycode/client-detector

使用

上手

import { createClientDetector } from '@easycode/client-detector';

const serviceHost = 'https://demo.com/data-bury'; // 必填,服务请求地址
const serviceName = 'test-service'; // 必填且唯一,找管理员查询
const userId = 'visitor'; // 可选,用户id,默认是visitor
const buryId = ''; // 选填,32位uuid,前端生成,不填则由后端生成


const clientDetector = createClientDetector(serviceHost,{
    serviceName,
    userId,
    buryId
});


const Demo: FC<NavigatorDemoProps> = () => {
    useEffect(() => {
        // 发送客户端设备信息
        clientDetector.sendClientInfo();

    }, []);

    return (
        <div className={ styles.navigatorDemo }>
            Demo
        </div>
    );
};

设置UserId

import { createClientDetector } from '@easycode/client-detector';

const serviceHost = 'https://demo.com/data-bury'; // 必填,服务请求地址
const serviceName = 'test-service'; // 必填且唯一,找管理员查询
const userId = 'visitor'; // 可选,用户id,默认是visitor
const buryId = ''; // 选填,32位uuid,前端生成,不填则由后端生成


const clientDetector = createClientDetector(serviceHost,{
    serviceName,
    userId,
    buryId
});


const Demo: FC<NavigatorDemoProps> = () => {
    useEffect(() => {
        // userId为visitor
        clientDetector.sendClientInfo();

        setTimeout(() => {
            // 设置userId
            clientDetector.setUserId('0000000');
            // 获取客户端设备信息
            clientDetector.sendClientInfo();
        }, 1000);

    }, []);

    return (
        <div className={ styles.navigatorDemo }>
            Demo
        </div>
    );
};

开发

npm run dev
1.0.7

1 month ago

1.0.6

1 month ago

1.0.5

1 month ago

1.0.3

1 month ago

1.0.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago

0.1.0

1 month ago