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

@domain.js/cia

v0.2.3

Published

domain.js center 消息任务通用模块

Downloads

5

Readme

@domain.js/cia

Build status codecov

Installation

cnf

专属配置名称 cia | 名称 | 类型 | 必填 | 默认值 | 描述 | 样例 | | ---- | ---- | ---- | ------ | ---- | ---- | | concurrency | int | No | 10 | task exec concurrency | 10 | | storeKey | string | No | cia-store | redis storage hash key | cia-store |

deps

| 模块名 | 别名 | 用到的方法 | 描述 | | ------ | ---- | ---------- | ---- | | _ | None | isFunction, map | lodash | | async | None | eachSeries, queue| npm i async | | logger | None | info, error | domain.js/logger | | utils | U | tryCatchLog | utils functions | | redis | None | hset, hdel, hgetall | domain.js/redis |

Usage

regist

注册消息到系统,提前注册的好处是可以预知有那些消息,都需要什么样的订阅者

  • eventName string 必填 消息名称
  • validator function 可选 消息数据验证函数
  • types [Object]
    • type string 必填 订阅者类型名称
    • timeout integer 可选 订阅函数执行的超时限定, 单位毫秒,超时也不会中断,只是会触发一次超时函数的执行
    • validator function 可选,订阅函数返回值验证函数,校验失败直接抛出异常
cia.regist('eventName', submitValidatorFunction, [
  {
    type: 'cleanCache', // 必填 订阅的名称
    timeout: 1000, // 可选 
  }
]);

link

连接cia系统,通过waiter来接收对应的消息

  • eventName string 必填 消息名称
  • type string 必填 接待者类型,要和 regist types里的type匹配
  • waiter function 必填 订阅函数
cia.link('eventName', 'cleanCache', waiter);

submit

提交函数,当有消息产生的时候通过改函数提交上去

  • eventName string 必填 消息名称
  • data any 必填 消息体数据

setFn

设置超时函数和执行订阅错误接收函数, 不设置的时候默认是 logger.info 和 logger.error

  • type string 必填 函数类型,timeouterror
  • function function 必填 设置的函数

checkReady

检测系统是否已准备好,返回 turefalse

isExiting

获取系统是否正在退出中,返回 truefalse

isExited

获取系统是否已退出,返回 truefalse

getUnlinks

获取未被 link 的消息任务, 排查问题的时候需要用到