项目模板·Pro
纯 JavaScript 待办清单
用纯 JavaScript 模块写的待办清单:添加、原地编辑、勾选、筛选、清除已完成,数据保存在 localStorage。逻辑部分带有 Node 内置测试运行器的测试。在 DevBrowser 和应用自带的 Node.js 中运行,不需要 Linux。
安装它需要 PocketCode Pro。
如果你的 Android 设备上装了 PocketCode,这会在应用里打开此页面。
预览
文件
README.md
index.html
package.json
src/app.js
src/storage.js
src/todos.js
styles.css
test/todos.test.jsREADME.md
# To-do list in plain JavaScript A to-do list that runs in the browser with no framework and no build step: add, edit in place, tick off, filter and clear done items. The list is saved in the browser (localStorage). The logic lives in its own module with tests that run on Node's built-in test runner. ## Run it in PocketCode 1. Open `index.html` in the editor. 2. Tap the globe icon (DevBrowser) at the top of the editor. The app opens from the local preview server. 3. Add a few items and reload: they are still there. You don't need the Linux environment for this project. ## Run the tests - Open `test/todos.test.js` and tap Run. The app's own Node.js runs the file and prints each test with ok or not ok. - Or, in the terminal with the Linux environment and Node.js: `npm test`. ## Where things are | Path | What it does | |---|---| | `index.html` | The page and its form | | `styles.css` | Styles, with light and dark colours | | `src/todos.js` | The logic: plain functions, no DOM, easy to test | | `src/storage.js` | Saving and loading from localStorage | | `src/app.js` | Connects the page to the logic and draws the list | | `test/todos.test.js` | Tests for `src/todos.js` | ## Ideas to extend it - Add a due date: a new field in `addTodo`, a date input in the form and a test for it. - Drag to reorder: keep an `order` number on each item and sort by it in `visibleTodos`.1.0.0 的变更
首个版本。