django-multipage-template-f.../static/js/controllers/todo_controller.js
Andros Fenollosa 6cdc7f43a3 Add Stimulus
2022-04-19 21:51:43 +02:00

23 lines
485 B
JavaScript

import { Controller } from "../vendors/stimulus.js"
import { sendData } from "../webSocketsCli.js"
export default class extends Controller {
static targets = [ "task" ]
/**
* Render new task
* @return {void}
*/
addNewTask() {
sendData({
action: 'Add task',
data: {
newTask: this.taskTarget.value
}
}, window.myWebSocket);
// Clean input
this.taskTarget.value = '';
}
}