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

chat-box-js

v2.0.0

Published

component to make chat box

Downloads

4

Readme

Chat

不依赖jquery,极简单的方式创建一个聊天界面

how to use

by npm

const Chat = require('chat-box-js');

new Chat({
  el: '.phone',  // 挂载的dom, 聊天界面渲染在这个dom上,宽高都是100%
  title: '聊天',
  beforeRender() {
    // dom创建之前,可以去localstorage或者远程拿历史消息
  },
  afterRender() {
    this.run('onRecvMsg', '你好, 很高兴认识你'); // dom添加之后调用,可以渲染历史消息,或者欢迎语
  },
  send(msg) {
    this.run('renderItem', msg, 'right');  // 把自己说的话添加至dom
    // send msg  可以通过ajax或者websocket发送文案

    this.run('onRecvMsg', '机器人自动回复:' + Math.random().toFixed(2) * 100);  // 添加一条回复至dom
  },
}).init();

查看demo

npm run server

访问http://localhost:3000/demo

script 暂时没有cdn,可以下载下来

<script src="index.min.js"></script>  // 引入index.min.js
<script>
new Chat({
/*
  options
*/
})
</script>