open-index/open-npm huggingface dataset:
npm package: @gdin/szgw-libs
Description: 数字广物工具库
Latest version: 0.0.2

# szgw-libs

数字广物工具库

- `sdk` App 端与 Web 端通讯的 js sdk 库
- `widget` PC 浮窗小组件

# sdk

数字广物专窗 - App 端与 Web 端通讯的 js sdk 库

## 使用

### 1. npm 方式

```shell
yarn add @gdin/szgw-libs
```

```js
import { sdk } from '@gdin/szgw-libs';

// ......

sdk.getVersion();
```

### 2. script 引入

```html
<script src="http://gdin.com.cn/szgw-libs/sdk.min.js"></script>
```

默认是最新版本，亦可引入指定某个版本，如：

```html
<script src="http://gdin.com.cn/szgw-libs/0.0.1/sdk.min.js"></script>
```

使用`script`加载`sdk`插件后，会默认挂载到`window.szgwSdk`上，如：

```js
window.szgwSdk.getVersion();
```

## API 方法

| 名称 | 说明 | 类型 |
| --- | --- | --- |
| getVersion | 获取版本信息 | () => [android/ios, version] |
| isInApp | 是否在 APP 内 | () => boolean |
| getToken | 获取登录凭证 | () => Promise<{ token: string; expire: number }> |
| getNetworkStatus | 获取网络状态 | () => Promise<[NetworkState](#networkstate-网络状态)> |
| on | 监听 APP 事件 | (event: [Event](#event-事件监听), callback: `(data) => void`) => void |
| off | 取消监听 | (event: [Event](#event-事件监听)) => void |

`@TODO` 更多 api 还在开发中......

## Event 事件监听

`注：多次监听同一事件，只会处理最后一次的监听事件`

| 名称          | 说明         | 返回值                                 |
| ------------- | ------------ | -------------------------------------- |
| networkStatus | 网络状态变化 | [NetworkState](#networkstate-网络状态) |

`@TODO` 更多事件监听还在开发中......

#### NetworkState 网络状态

| 参数                | 说明              | 类型                    |
| ------------------- | ----------------- | ----------------------- |
| isConnected         | 有网络连接        | `boolean` &#124; `null` |
| isInternetReachable | 可以访问 Internet | `boolean` &#124; `null` |
| networkType         | 网络类型          | `string` &#124; `null`  |

`networkType` 的值有：

`wifi`、`2g`、`3g`、`4g`、`5g`、`unknown`、`none`

# widget

数字广物专窗 - `快捷应用` 浮窗小组件

## 使用

### 1. npm 方式

```shell
yarn add @gdin/szgw-libs
```

```js
import { widget } from '@gdin/szgw-libs';

// ......

widget.initialize(options);
```

### 2. script 引入

```html
<script src="http://gdin.com.cn/szgw-libs/widget.min.js"></script>

<!-- 样式文件 -->
<link rel="stylesheet" href="http://gdin.com.cn/szgw-libs/widget.min.css" />
```

默认是最新版本，亦可引入指定某个版本，如：

```html
<script src="http://gdin.com.cn/szgw-libs/0.0.1/widget.min.js"></script>
```

使用`script`加载`widget`插件后，会默认挂载到`window.szgwWidget`上，如：

```js
window.szgwWidget.initialize(options);
```

## API

| 名称 | 说明 | 类型 |
| --- | --- | --- |
| initialize | 初始化，创建组件实例 | (options: [InitializeParams](#initializeparams)) => void |
| run | 加载组件，`manual=true`时，需先调用此方法才会显示浮窗小图标 | (options?: [InitializeParams](#initializeparams)) => void |
| show | 显示浮窗主体内容 | () => void |
| hide | 关闭浮窗 | () => void |

#### InitializeParams

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| username | 用户名，`必传` | string |  |
| manual | 初始化完成后，是否手动加载组件，默认自动加载 | boolean | `false` |
| url | 浮窗主体 iframe 加载的网页地址 | string | `http://portal.gdwz.com/#/widget` |
npm package: @gdistel/calden-lib
Description: This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.6.
Latest version: 0.0.7

# CaldenLib

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.6.

## Code scaffolding

Run `ng generate component component-name --project calden-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project calden-lib`.
> Note: Don't forget to add `--project calden-lib` or else it will be added to the default project in your `angular.json` file. 

## Build

Run `ng build calden-lib` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build calden-lib`, go to the dist folder `cd dist/calden-lib` and run `npm publish`.

## Running unit tests

Run `ng test calden-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).