New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bizify

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bizify

The bizify library for easy write business logic.

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

bizify

一个实践 OOP 的业务框架,分离前端业务逻辑与 UI。让不同的同学写更一致的代码。

文档可见:https://hstarorg.github.io/bizify

Usage

在控制类中以 OOP 的风格编写业务逻辑

// Demo1Ctrl.ts
import { ControllerBaseProxy } from 'bizify';

type DemoPageData = {
  val: number;
};

export class Demo1Ctrl extends ControllerBaseProxy<DemoPageData> {
  $data(): DemoPageData {
    return { val: 1 };
  }

  // 注意用箭头函数
  plus = () => {
    this.data.val += 1;
  };
}

使用 useController 连接控制类和 UI(React)

import React from 'react';
import { Button } from 'antd';
import { useController } from 'bizify';
import { Demo1Ctrl } from './Demo1Ctrl';

export default function Demo1() {
  const vm = useController<Demo1Ctrl>(Demo1Ctrl);
  const vmData = vm.data;
  return (
    <div>
      <span>当前value: {vmData.val}</span>
      <br />
      <Button type="primary" onClick={vm.plus}>点我加 1</Button>
    </div>
  );
}

Keywords

FAQs

Package last updated on 04 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc