-
-
Notifications
You must be signed in to change notification settings - Fork 328
-
Coming from using a different reactive, backend-driven framework, I am used to being able to send arbitrary data using a simple javascript api. The library in question is Livewire, built for the PHP framework, Laravel. They include a js lib which creates some directives to help you along the way and can do things like:
<script>
const datepicker = document.getElementById('datepicker');
DatePickerLibrary('#datepicker', {
onUpdate: (value) => $wire.set('date', value)
})
// Their js util library provides "$wire" function to perform, in this case, an ajax call to update the backend
// You could as well do this:
$wire.set('name', name) // set's the server-side property
</script>
Trying to create some interactive form fields and components with idom I feel something like this will be really useful.
Is there anything that exists already that may achieve something similar - setting backend properties via some javascript call?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 6 replies
-
Last I recall, I was told the API exists but is not documented.
See related issue
Beta Was this translation helpful? Give feedback.
All reactions
-
Yep, docs need to be updated to show both directions.
Beta Was this translation helpful? Give feedback.
All reactions
-
Ok, any pointers where to look for this myself?
Beta Was this translation helpful? Give feedback.
All reactions
-
I havent dug into the JavaScript API, so I'd need to defer that question to Ryan.
Beta Was this translation helpful? Give feedback.
All reactions
-
IDOM allows to write custom components for this purpose. Here's a template repo that could help you get started. I'm on vacation so I can't provide more detail now, but when I'm back I'd be happy to explain further or meet to chat about this or anything else.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@wrabit, has the custom component interface worked well for you?
Beta Was this translation helpful? Give feedback.