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

@aluni/plugin-x

v0.0.5

Published

@aluni/plugin-x

Downloads

19

Readme

@aluni/plugin-x

See our website inula for more information.

Inula-X 是集成在openinula框架中用于状态管理的库。它能集中式地存储、管理应用中所有组件的状态,并通过相应的规则(actions)保证状态(state)以可预测的方式发生变化。

使用方式

默认会将 src/stores 下的 store 定义自动挂载,你只需要在 stores 文件夹中新建文件即可新增一个 store 用来管理组件状态。详细的 store 写法和用法,请参考 Inula-X 文档。

store 文件将会被自动挂为 ${store.id}Store ,然后可以直接从 inula 中导出使用 import { helloStore } from 'inula';

注意 createStore, clearStore 和 useStore 是 openinula 导出的功能,所以无法创建一个同名的 store

对于某个 pages 文件夹下面的 store 也会默认挂载

请注意使用约定式路由时你无法创建一个名为 /store 路径的页面

新建一个 store 文件,可以使用 inula g x storeName 快速创建模版文件,如 npx inula g x hello

import { createStore } from 'inula';

export default  createStore({
  id: 'hello',
  actions: {
  },
  state: {
    title: 'hello',
  },
});

一个比较简单的用例子,src/stores/hello.ts

import { createStore } from 'inula';

export default  createStore({
  id: 'hello',
  actions: {
    changeName: (state) => {
      state.title = 'openinula';
    },
  },
  state: {
    title: 'inulajs',
  },
});

在页面中使用

import { helloStore } from 'inula';

const Page = () => {
  const store = helloStore();
  return (
    <div>
      hello {store.title}
      <button
        onClick={() => {
          store.changeName();
        }}
      >
        改名字啦
      </button>
    </div>
  );
};

export default Page;