跳转到内容
项目模板·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.js

README.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 的变更

首个版本。

相关

无依赖的 Node.js JSON APIPro项目模板基于 node:http 的笔记 API:创建、列出、修改、删除,带输入校验和 JSON 错误信息,数据保存到文件。无需安装任何东西:在 server.js 上点 Run,应用自带的 Node.js 会在 localhost:3000 启动它。附带测试。Markdown 静态网站Pro项目模板用 Markdown 写页面,再构建成带统一布局和菜单的静态 HTML 网站。构建脚本约 110 行 Node.js,可以随意修改,唯一的依赖是 marked。在 DevBrowser 中打开结果。首次 npm install 需要 Linux 环境。Express + SQLite 任务 APIPro项目模板基于 Express 5 的任务 API,支持筛选、分页并附带测试。数据存入 node:sqlite,无需编译原生模块。需要带 Node.js 22.13 或更新版本的 Linux 环境;npm install 约下载 3.5 MB。Vite + React + TypeScriptPro项目模板用 React 和 TypeScript 写的习惯打卡应用,基于 Vite 8:每周网格、连续天数、一个自定义 hook 和一个测试。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 25 个包(约 80 MB)。Next.js + Tailwind + i18nPro项目模板Next.js 15 项目,带 next-intl 和 Tailwind CSS,在 /en 和 /es 提供一个英语和西班牙语页面。深色模式跟随系统。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 400 MB。静态落地页Pro项目模板纯 HTML 和 CSS 编写的单页网站:带折叠菜单的页头、首屏、功能网格、常见问题和页脚。颜色跟随系统的浅色或深色模式。无需构建,也不需要 Linux:打开 index.html,点地球图标即可。