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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhihu/ailab-sdk

v0.2.1

Published

AI Lab SDK

Readme

AILab SDK

用于实现知乎 App 内部通信的 SDK, AI Lab 专用。

安装

npm install @zhihu/ailab-sdk

快速开始

初始化

方式一:使用 NPM 安装

import { AILabSDK } from '@zhihu/ailab-sdk';

const sdk = new AILabSDK({
  debug: true           // 开启调试日志
});

方式二:使用 CDN 引入

CDN 地址:https://unpkg.zhimg.com/@zhihu/ailab-sdk@:version/dist/index.min.js

:version 为版本号,请替换为实际版本号。显式指定版本,避免因依赖更新导致意外问题。 可以使用 npm dist-tags @zhihu/ailab-sdk 查看当前最新版本号。

<script src="https://unpkg.zhimg.com/@zhihu/[email protected]/dist/index.min.js"></script>
<script>
  const sdk = new AILab.AILabSDK({
    debug: true           // 开启调试日志
  });
</script>

使用

示例用法

// 页面导航
try {
  await sdk.navigateTo('path?key=value&key2=value2');
} catch (error) {
  console.error('导航失败:', error);
}

// 销毁实例(防止内存泄漏)
sdk.dispose();

API 文档

核心方法

dispose(): void

销毁 SDK 实例,清理所有事件监听器和挂起的消息。页面销毁前保证调用该方法,防止内存泄漏。

页面导航

navigateTo(url: string): Promise<void>

导航到当前应用下其他页面地址,会 push 进一个路由地址。不使用该方法打开链接或者操作路由,不会添加路由。

参数:

  • url: 目标路径,格式为 'path?key=value&key2=value2'

openZhihuPage(url: string): Promise<void>

打开一个知乎页面。*注意:仅支持 https 协议且主域名为 .zhihu.com 的链接。

参数:

  • url: 目标知乎页面地址,格式如 'https://www.zhihu.com/question/1'