Django LiveView Frontend is a set of JavaScript functions that are responsible form managing everything that a backend developer would do.
- WebSocket connection.
- Events.
- Submit actions.
- Capture the responses from the backend and place the HTML in the indicated place.
- Form submission.
- History management.
- Show the page offline in case you lose your internet connection.
Events are manage by Stimulus, a JavaScript framework that allows you to create controllers that are responsible for managing a specific part of the DOM. The rest of the code is written in plain JavaScript.
Add the following line to your HTML.
<script defer type="module" src="https://cdn.jsdelivr.net/gh/Django-LiveView/frontend/js/main.js"></script>
You only need to download the js
folder and link main.js
in your HTML file.
<script defer type="module" src="js/main.js"></script>