npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gdin/szgw-libs

v0.0.2

Published

数字广物工具库

Downloads

5

Readme

szgw-libs

数字广物工具库

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

sdk

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

使用

1. npm 方式

yarn add @gdin/szgw-libs
import { sdk } from '@gdin/szgw-libs';

// ......

sdk.getVersion();

2. script 引入

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

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

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

使用script加载sdk插件后,会默认挂载到window.szgwSdk上,如:

window.szgwSdk.getVersion();

API 方法

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

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

Event 事件监听

注:多次监听同一事件,只会处理最后一次的监听事件

| 名称 | 说明 | 返回值 | | ------------- | ------------ | -------------------------------------- | | networkStatus | 网络状态变化 | NetworkState |

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

NetworkState 网络状态

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

networkType 的值有:

wifi2g3g4g5gunknownnone

widget

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

使用

1. npm 方式

yarn add @gdin/szgw-libs
import { widget } from '@gdin/szgw-libs';

// ......

widget.initialize(options);

2. script 引入

<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" />

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

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

使用script加载widget插件后,会默认挂载到window.szgwWidget上,如:

window.szgwWidget.initialize(options);

API

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

InitializeParams

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | username | 用户名,必传 | string | | | manual | 初始化完成后,是否手动加载组件,默认自动加载 | boolean | false | | url | 浮窗主体 iframe 加载的网页地址 | string | http://portal.gdwz.com/#/widget |