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

@seayoo-web/login

v1.1.7

Published

seayoo login

Readme

Seayoo Login

Gamer Web Login

import { NetRequest } from "@seayoo-web/request";
import { AuthToken } from "@seayoo-web/gamer-api";
import { GamerWebAuth } from "@seayoo-web/login";

// 创建 AuthToken 实例
const authToken = new AuthToken(SY_GAMER_API, NetRequest);
// 修改请求工具配置
authToken.req.setConfig({
  messageHandler(_, message) {
    toast(message);
  },
  errorHandler({ status, rawError, sentryError, sentryTags, sentryExtra }) {
    if (status === 401) {
      // 提示或直接登录
      // toast('xxx')
      gamerAuth.login();
      return;
    }
    // 意外错误进行上报
    if (rawError) {
      captureException(sentryError, {
        extra: sentryExtra,
        tags: sentryTags,
      });
    }
  },
});

// 创建 GamerAuth 实例,可选登录组件配置
const gamerAuth = new GamerWebAuth(authToken, {
  anonymous: false,
  hidePasswordLogin: false,
  // 更多配置见类型 AccountLoginOption
});
// 可以在需要的时候修改登录组件参数
gamerAuth.config({
  hidePasswordLogin: true
});

// 上报登录过程中的异常
gamerAuth.onError(function (error) {
  captureException(error);
});

// gamerAuth 方法
// 是否登录
gamerAuth.isLoggedIn();
// 登录
const result = await gamerAuth.login();
// 退出
gamerAuth.logout();
// 获取用户信息,默认读取页面缓存(session cache)
const userInfo = await gamerAuth.getUserInfo();
// 获取最新的用户信息
const userInfo2 = await gamerAuth.getUserInfo(true);
// 实名认证
await gamerAuth.realNameAuth({ ... });

Gamer Weixin Login

import { NetRequest } from "@seayoo-web/request/wx"; // 与 web 使用不同
import { AuthToken, WeixinApi } from "@seayoo-web/gamer-api";
import { GamerWeixinAuth } from "@seayoo-web/login"; // 与 web 使用不同

// 创建 AuthToken 实例
const authToken = new AuthToken(SY_GAMER_API, NetRequest);
// 修改请求工具配置
authToken.req.setConfig({
  messageHandler(_, message) {
    toast(message);
  },
  errorHandler({ status, rawError, sentryError, sentryTags, sentryExtra }) {
    if (status === 401) {
      // 提示或直接登录
      // toast('xxx')
      gamerAuth.login();
      return;
    }
    // 意外错误进行上报
    if (rawError) {
      captureException(sentryError, {
        extra: sentryExtra,
        tags: sentryTags,
      });
    }
  },
});

// 创建 WeixinApi 实例
const weixinApi = new WeixinApi(authToken, APP_ID);
// 创建 GamerWeixinAuth 实例
const gamerAuth = new GamerWeixinAuth(authToken, weixinApi);

// gamerAuth 方法
// 是否登录
gamerAuth.isLoggedIn();
// 检测登录状态变更
// 默认在缓存有长期登录token的时候会自动触发登录,登录后会通知状态变更
gamerAuth.onStatusChange((loggedIn) => {
  console.log("当前登录状态为", loggedIn);
});
// 自动登录(有缓存的长期登录token时)
// 以下自动登录逻辑会在实例创建的时候执行,不需要手动触发
if (gamerAuth.hasLoginToken) {
  const result = await gamerAuth.login();
}
// 页面上显示登录按钮时,需要用户授权手机号访问,获得微信返回的授权 code
// 然后执行登录流程
const result = await gamerAuth.login(WeixinCode);
// 退出
gamerAuth.logout();
// 获取 unionId 和 openId
await gamerAuth.getUnionId();
await gamerAuth.getOpenId();
// 获取用户信息,优先读取页面缓存(session cache)
await gamerAuth.getUserInfo();
// 从服务器获取最新的用户信息
await gamerAuth.getUserInfo(true);