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

heshuo-im-sdk

v1.1.5

Published

heshuo im sdk

Downloads

18

Readme

im-sdk

调用方式

  1. 在项目中引入, 实例化IM对象(传入vuex对象,和IM进行绑定)
    import store from './store'
    import IM from '../lib/sdk'
    const im = new IM(store, {
    	baseUrl: process.env.VUE_APP_BASE_API + '/rainbowchat_server',
    	baseAdminUrl: process.env.VUE_APP_BASE_ADMIN_URL,
    	baseImUrl: process.env.VUE_APP_BASE_NODE_API,
    	CHATTING_HISTORY_LOAD_TIME_INTERVAL: 3
    })
    Vue.prototype.$im = im
  2. 项目中直接使用this.$im进行调用IM的方法
  3. 如在项目中直接引入打包前的文件,可在vue.config.js或者webpack.config.js中注入变量, 用户区分小程序还是web
    • vue.config.js
    	configureWebpack: {
    		plugins: [
    			new webpack.DefinePlugin({
    				PLATFORM: JSON.stringify(process.env.PLATFORM),
    			})
    		]
    	}
    • webpack.config.js
     plugins: [
    	new webpack.DefinePlugin({
    		PLATFORM: JSON.stringify(process.env.PLATFORM),
    	})
     ]
  4. 常用功能可参考im-merchant
  5. 详细内容可参考wiki

restful接口

包含在im的restApi对象中,其返回为promise

使用方式

  1. 使用回调函数 回调函数定义于im的adopter对象中,可调用im.adopter.description进行查看详细内容
  2. 使用sdk中数据进行驱动
    • sdk中的数据存在于vuex中,im构造函函数将sdk中vuex modules动态载入了主项目中的vuex中,命名为imStore模块
    • 可使用普通的vuex方法(如mapState等)使用

自定义消息

  1. 消息的发送 参考messageHelper.sendSelfMsg方法
  2. 消息的接收展示 参考chatMsgHelper.createChatMsgEntity_COME_SELF以及chatMsgHelper.setCreateChatMsgEntity_COME_SELF方法,具体参考wiki
  3. 消息列表的展示 参考messageHelper.selfMsgContentForShow以及messageHelper.setSelfMsgContentForShow方法,具体参考wiki