@alt-javascript/boot-alpine
v3.0.7
Published
Alpine.js integration for @alt-javascript boot — CDI services accessible from Alpine components
Maintainers
Readme
@alt-javascript/boot-alpine
Alpine.js integration for the @alt-javascript framework. CDI-managed services accessible from Alpine components via $store.cdi.
Part of the @alt-javascript monorepo.
Install
npm install @alt-javascript/boot-alpineUsage
<script type="module">
import { bootAlpine } from '@alt-javascript/boot-alpine';
await bootAlpine({ contexts: [context], config, Alpine: window.Alpine });
</script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js"></script>
<div x-data>
<p x-text="$store.cdi.greetingService.greet('World')"></p>
</div>All CDI singletons are registered on Alpine.store('cdi'). The ApplicationContext is available as $store.cdi.ctx.
Custom Store Name
await bootAlpine({ contexts, config, Alpine, storeName: 'services' });
// Access as $store.services.todoServiceLicense
MIT
