@evio/define
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@evio/define

TODO: description

Usage

import { define, Hook } from './index';
const hook = new Hook();
(async () => {
  const c = define(async (props, { useHook }) => {
    const x = await useHook('z', () => {
      return {
        value: 99
      }
    })
    return 100 + x.value
  })
  const a = define(async (props: { a: number }, { useHook, useDefine }) => {
    const x = await useHook('z', () => {
      return {
        b: 199 + props.a
      };
    })
    const km = await useDefine(c);
    return 1 + x.b + km;
  })

  hook.use(a).on('z', (value: { b: number }) => {
    value.b++;
  })

  hook.use(c).on('z', (value: { value: number }) => {
    value.value++;
  })


  const b = await a({ a: 2 }, hook);
  console.log(b)
})()

/@evio/define/

    Package Sidebar

    Install

    npm i @evio/define

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    8.02 kB

    Total Files

    12

    Last publish

    Collaborators

    • evio