# @volcengine/tls-js-sdk

> tls js sdk

Latest version **0.0.3** (published 2022-10-25) · 0 weekly downloads

## Install

```sh
npm install @volcengine/tls-js-sdk
pnpm add @volcengine/tls-js-sdk
yarn add @volcengine/tls-js-sdk
bun add @volcengine/tls-js-sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-10-25 |
| First published | 2022-09-15 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 609.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zhanglinjun.xinger, cmaxd, liuzhao.90, yangwenhan, liucheng.bigorange, zhouyk, leifangfang, zhangzhimeng.vivi, oanakiaja, chenyongjin, moonball, shushushu, changzhn, wudechang, lixiangfeiorg, goldvideo, leonardo-fu, awesome-starling, zhang6464, volcanoengine, bytednpm |
| Keywords | browser, tls, js, sdk |

## Links

- npm: https://www.npmjs.com/package/@volcengine/tls-js-sdk
- npm.io page: https://npm.io/package/@volcengine/tls-js-sdk

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.3 (latest) — 2022-10-25
- 0.0.2 — 2022-09-15
- 0.0.1 — 2022-09-15

## README

# TLS JS SDK 
[中文文档](https://github.com/volcengine/tls-js-sdk/blob/master/README.zh_CN.md)

This is TLS JS SDK for browser.
> TLS is short for Tinder Log Service.

# Installation

```shell
npm install -S @volcengine/tls-js-sdk
```

# Basic Usage

Import in the module file
```typescript
import { WebTrackerBrowser } from '@volcengine/tls-js-sdk';

const wtb = new WebTrackerBrowser({
  host: 'your host',
  projectId: 'your projectId',
  topicId: 'your topicId',
});

```

Import directly in the browser
```html
<html>
<head></head>
<body>
<script src="path/to/tls-js-sdk/dist/tls_browser.js"></script>
<script>
    const wtb = new TLS_Browser.WebTrackerBrowser({
        host: 'your host',
        projectId: 'your projectId',
        topicId: 'your topicId',
    });
</script>
</body>
</html>

```

# API
## WebTrackerBrowser
Class for web tracker in browser

```typescript
import { WebTrackerBrowser } from '@volcengine/tls-js-sdk';

const wtb = new WebTrackerBrowser({
  host: 'your host', // required
  projectId: 'your projectId', // required
  topicId: 'yourt topicId', // required
  protocol: 'your protocol', // optional.The default value is https
  time: 'batch log time interval', // optional.The default value is 10s.
  count: 'batch log limit', // optional.The default value is 10.
  source: 'log source', // optional.
});
```

WebTrackerBrowser instance method below.

### send

send(data)

| params  | description                                                                    |
|:--------|:-------------------------------------------------------------------------------|
| data    | (required) like { [index: string]: any } |

```typescript
wtb.send({
  key: 'value', // custom key/value
});
```

### sendImmediate

sendImmediate(data)

| params  | description                                                                    |
|:--------|:-------------------------------------------------------------------------------|
| data    | (required) like { [index: string]: any } |

```typescript
wtb.sendImmediate({
  key: 'value', // custom key/value
});
```

### sendBatchLogs
sendBatchLogs(data)

| params  | description                                                                                                                                                       |
|:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| data    | (required)  like Array<Record<string, any>>                                                                                                                                          |

```typescript
wtb.sendBatchLogs([{ key: 'value' }]);
```

### sendBatchLogsImmediate

sendBatchLogsImmediate(data)

| params  | description                                          |
|:--------|:-----------------------------------------------------|
| data    | (required) like Array< Record<string, any>[]>                              |

```typescript
wtb.sendBatchLogsImmediate([{ key: 'value' }])
```
## Security

If you discover a potential security issue in this project, or think you may
have discovered a security issue, we ask that you notify Bytedance Security via our [security center](https://security.bytedance.com/src) or [vulnerability reporting email](sec@bytedance.com).

Please do **not** create a public GitHub issue.

# License
This project is licensed under the [MIT License](./LICENSE).

---
_Source: https://npm.io/package/@volcengine/tls-js-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
