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

@hecom/userinfo

v1.0.8

Published

User Information and Login or Logout Action

Downloads

11

Readme

UserInfo

npm version Build Status

这是当前用户登陆信息管理模块。还包括登陆和登出的统一接口,以及各种登陆登出流程的处理。

接口

  • name: string:模块名称。
  • initGlobal: () => Promise:全局初始化模块。
  • addLoginHandler: (func) => void:添加登陆的处理函数,这是在触发登陆成功事件之前调用的,func必须是() => Promise格式的函数。
  • login: (user, forceUpdate) => Promise:用户登陆,写入user信息,触发登陆事件。
  • loginProcess: (objParams) => Promise:登陆流程,objParams包含如下参数:
    • username:用户名。
    • password:密码。
    • verifyCode:验证码,如果此项不为空,则使用验证码登陆接口。
    • onFinish:成功回调函数,返回用户信息。
    • apiRefresh:刷新加载框状态的方法。
  • loginIM: (userInfo) => Promise:根据用户信息登陆IM,如果userInfo为空,则使用内部当前用户信息。
  • logout: (prompt) => Promise:登出用户,并跳转到登陆流程页面,prompt表示是否弹框提示。
  • isLogin: () => boolean:是否是已登陆状态。
  • enterMain: () => Promise:持久化存储已有的用户信息,并跳转到主流程页面。
  • get: () => object:获取当前用户信息。
  • getLastUser: () => object:获取上一个用户的遗留信息。
  • set: (key, value) => Promise:设置当前用户的详细信息。
  • update: (userParts) => Promise:批量设置当前用户信息
  • register:注册事件。
    • userChange: (func) => string:注册用户详细信息改变的事件,返回事件Id。
  • unregister:注销事件。
    • userChange: (funcId) => boolean:注销用户详细信息改变事件,返回成功与否。
  • part:获取当前用户的详细信息。
    • avatar: () => string:自定义头像的URL地址。
    • name: () => string:用户名称。
    • code: () => string:用户Code。
    • dept: () => object:部门信息。
    • entCode: () => string:企业Code。
    • uid: () => string:UID。
    • accessToken: () => string:AccessToken。
    • phone: () => string:电话号码。
    • imId: () => string:环信IM的Id。

事件类型

  • 用户信息改变事件:类型为[UserChangeEvent];无数据。