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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mpkit/inject

v1.1.2

Published

提供小程序环境适用的多种实用函数或组件,如setData优化、Mixin、事件总线等。

Downloads

40

Readme

@mpkit/inject

Build Status image image image

提供小程序环境适用的多种实用函数或组件,如 setData 优化、Mixin、事件总线等。

教程:https://imingyu.github.io/2020/mpkit/

| 方法/变量 | 作用 | 依赖插件 | | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | on(eventName:string, handler:Function) | 为某全局事件添加监听函数 | ebus | | off(eventName:string, handler:Function) | 为某全局事件移除监听函数 | ebus | | emit(eventName:string, data:any) | 触发某全局事件并传递数据 | ebus | | App(...mixins:MpAppSpec[]) : MpAppSpec | 接收多个对象,对象结构与小程序App函数接收的对象结构一致,并将这些对象合并,返回一个新对象,包含所有对象的功能和数据,合并策略下文描述。 | mixin | | Page(...mixins:MpPageSpec[]) : MpPageSpec | 接收多个对象,对象结构与小程序Page函数接收的对象结构一致,并将这些对象合并,返回一个新对象,包含所有对象的功能和数据,合并策略下文描述。 | mixin | | Component(...mixins:MpComponentSpec[]) : MpComponentSpec | 接收多个对象,对象结构与小程序Component函数接收的对象结构一致,并将这些对象合并,返回一个新对象,包含所有对象的功能和数据,合并策略下文描述。 | mixin | | Api | 与小程序上的wx my swan tt等对象的属性和方法一致,只不过在其方法上添加了钩子函数,方便拦截处理 | mixin | | MixinStore.addHook(type:string, hook:MpMethodHook) | MpKit中内置了很多全局钩子函数,方可实现了全局拦截,setData 重写等功能,而如果你也想在全局添加自己的钩子函数,那么可以调用此函数 | mixin | | setData(view:any, data:any, callback:Function) : Promise<DiffDataResult> | 以优化的方式向某个 Page/Component 设置数据,仅设置变化的数据,并以 Promise 的方式返回 diff 后的数据结果 | set-data |