Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@alt-javascript/boot-alpine

Language npm version License: MIT CI

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-alpine

Usage

<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.todoService

License

MIT