@e7w/easy-model
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

简单模型(easy-model)

一个简单的状态管理包.
A simple state management lib for Typescript

例子(Example)

import { provide, subscribe } from "@e7w/easy-model";

const A = provide(
  class A {
    msg = "1";

    constructor(private id: number) {}

    random() {
      this.msg = `${Math.random()}`;
    }
  }
);

A(1) === A(1); // true
A(1) !== new A(1); // true
subscribe(A(1), console.log.bind(console, "Path of changed value:"));
const { random } = A(1);
random(); // Path of changed value: ["msg"]

Readme

Keywords

Package Sidebar

Install

npm i @e7w/easy-model

Weekly Downloads

6

Version

0.0.12

License

ISC

Unpacked Size

21.6 kB

Total Files

13

Last publish

Collaborators

  • q344275632