UNPKG

@maizzle/framework

Version:

Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.

24 lines (23 loc) 537 B
import { RenderContextKey } from "./renderContext.js"; import { inject } from "vue"; //#region src/composables/useEvent.ts /** * Register an event handler from within an SFC's <script setup>. * * Usage: * ```ts * useEvent('beforeRender', ({ config, template }) => { * return template.source.replace('foo', 'bar') * }) * ``` */ function useEvent(name, handler) { const ctx = inject(RenderContextKey); if (ctx) ctx.sfcEventHandlers.push({ name, handler }); } //#endregion export { useEvent }; //# sourceMappingURL=useEvent.js.map