1.0.15 • Published 3 years ago

@atomintl/shared-logic-deposit v1.0.15

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

买币集合页 WEB/RN 公用逻辑

  • 示例

下面示例为 otc 示例,其他比如兑换、fastbuy 都是继承于同一基类,所以使用方式都是统一的

import { OtcOrderHelper, OrderType, EventName, OrderCheckReturn } from "@atomintl/shared-logic-deposit"

const Demo: React.FC = () => {
    // 实例化对象也可赋值给useRef
    const OtcHelper = new OtcOrderHelper(useLazyFetch)

    // 用监听方式,监听数据变化,不同的EventName对应不同的业务
    OtcHelper.subscribe<OrderCheckReturn>(EventName.OrderCheck, val => {
        console.log(val)
    })
    OtcHelper.subscribe(EventName.OrderCheck1, val => {
        console.log(val)
    })

    useEffect(() => {
        OtcHelper.handleOrderCheck(OrderType.Sell)
    }, [])

    useEffect(() => {
        // 也可以直接调用具体的方法获取数据
        OtcHelper.handleOrderCheck(OrderType.Buy).then(
            res => console.log(res) // 业务数据
        )
    }, [])
}
1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago