botserver/web/desktop/tasks/store.js
Rodrigo Rodriguez (Pragmatismo) 4b185f00f9 feat: add HTTP server and refactor initialization
- Added HTTP server with CORS support and various endpoints
- Introduced http_tx/http_rx channels for HTTP server control
- Cleaned up build.rs by removing commented code
- Updated .gitignore to use *.rdb pattern instead of .rdb
- Simplified capabilities.json to empty object
- Improved UI initialization with better error handling
- Reorganized module imports in main.rs
- Added worker count configuration for HTTP server

The changes introduce a new HTTP server capability while cleaning up and improving existing code structure. The HTTP server includes authentication, session management, and websocket support.
2025-11-15 09:48:46 -03:00

32 lines
666 B
JavaScript

document.addEventListener('alpine:init', () => {
Alpine.store('todo', {
title: 'Todo',
items: [],
nextId: 1,
addTodo(text) {
if (!text.trim()) return;
this.items.push({
id: this.nextId,
title: text.trim(),
done: false
});
this.nextId++;
},
toggleTodo(id) {
this.items = this.items.map(item =>
item.id === id ? { ...item, done: !item.done } : item
);
},
removeTodo(id) {
this.items = this.items.filter(item => item.id !== id);
},
clearCompleted() {
this.items = this.items.filter(item => !item.done);
}
});
});