petitpy / todo
TodoMVC, Python on the wire
A classic TodoMVC built with the ADR-006 js bridge. Python owns the todo list, the filter state, and the DOM rendering; JS owns only the wasm loader and a tiny event-stash shim that surfaces clicked list-item ids back into Python. List state round-trips through localStorage as hand-rolled JSON because the bridge doesn't marshal native dicts.
Loading…
0 items left
Notes
Each li carries its todo id on a data-id attribute. A single delegated click handler on the ul reads e.target.closest("li").dataset.id and the action (toggle or delete) from the clicked element, stashes them on window._todoId/window._todoAction, then invokes the zero-arg window._py_action. Stashing on globals works around the bridge dropping callback arguments.