package.src.directives.x-text.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alpinejs Show documentation
Show all versions of alpinejs Show documentation
The rugged, minimal JavaScript framework
import { directive } from '../directives'
import { mutateDom } from '../mutation'
directive('text', (el, { expression }, { effect, evaluateLater }) => {
let evaluate = evaluateLater(expression)
effect(() => {
evaluate(value => {
mutateDom(() => {
el.textContent = value
})
})
})
})