use-draw.ts 305 B

123456789
  1. import { inject, provide, Ref } from 'vue'
  2. import { DrawExpose } from "@/index.ts";
  3. const actionKey = Symbol('drawAction');
  4. export const installDraw = (drawRef: Ref<DrawExpose | undefined>) => {
  5. provide(actionKey, drawRef)
  6. }
  7. export const useDraw = () => inject<Ref<DrawExpose | undefined>>(actionKey)!