nanopython  /  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 — the standard globals-stash workaround documented in notes/03 for the bridge's dropped-args caveat.