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

@wxa/core

v2.5.1

Published

wxa core feature

Downloads

97

Readme

@wxa/core

NpmLicense NPM version npm bundle size (minified + gzip) Github Actions

@wxa/core是一个非常小巧的包,提供了网络请求、缓存操作、事件总线、Mixins等能力。

core通过新增一个生命周期函数beforeRouteEnter,使得开发者可以快速实现预加载特性。

对于数据量较大的情况,通过提供一个内置的$diff,数据进行diff和flatten操作后再调用setData,减少每次传递的数据量,提高setData性能。:airplane:

core可以单独使用,但是一般推荐配合@wxa/cli2一起使用,体验更佳:kissing:

特性

  • :white_check_mark: Fetch 自动防重,自动队列管理的网络请求方法。
  • :white_check_mark: Router 简洁的跳转API,实现预加载的关键。
  • :white_check_mark: Eventbus 跨页面,跨组件交互的简单方案。
  • :white_check_mark: Mixins 混合,跨页面、跨组件复用逻辑。
  • :white_check_mark: Diff 增量设置数据。
  • :white_check_mark: Storage 小程序持久化缓存数据。
  • :white_check_mark: SessionStorage 应用周期内缓存数据。

安装

# 使用npm安装
npm i @wxa/core

简单用例

import {Page, Lock, Debounce} from '@wxa/core';

// Page装饰器,相当于引入Router、Storage、Fetch等装饰器
@Page
export default class Index {
    async onLoad() {
        let slogan = await this.foo();
    }

    async foo() {
        return await Promise.resolve('Hey, Async/Await is usabled');
    }

    @Lock
    @Debounce
    tap({detail: {value}}) {
        return this.$fetch('/log', {value});
    }
}