Skip to content

2Do

2Do 是一款强大的个人任务管理器,支持 GTD 方法论等。Protocol Launcher 允许您生成深度链接以在 2Do 中创建任务、搜索和导航列表。

使用方式

有两种使用此库的方式:

  • 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
  • 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。

生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

打开应用

On-Demand
ts
import { open } from 'protocol-launcher/2do'

const url = open()

显示所有任务

On-Demand
ts
import { showAll } from 'protocol-launcher/2do'

const url = showAll()

显示今天任务

On-Demand
ts
import { showToday } from 'protocol-launcher/2do'

const url = showToday()

显示星标任务

On-Demand
ts
import { showStarred } from 'protocol-launcher/2do'

const url = showStarred()

显示已安排任务

On-Demand
ts
import { showScheduled } from 'protocol-launcher/2do'

const url = showScheduled()

显示列表

On-Demand
ts
import { showList } from 'protocol-launcher/2do'

const url = showList({
  name: 'Work',
})

搜索任务

On-Demand
ts
import { search } from 'protocol-launcher/2do'

const url = search({
  text: 'John',
})

搜索逾期任务

On-Demand
ts
import { search } from 'protocol-launcher/2do'

const url = search({
  text: 'type:overdue',
})

新建任务(打开界面)

On-Demand
ts
import { addNewTask } from 'protocol-launcher/2do'

const url = addNewTask({
  ignoreDefaults: 1,
})

添加任务

On-Demand
ts
import { add } from 'protocol-launcher/2do'

const url = add({
  task: 'Dinner at 8pm',
  due: '1',
})

添加高优先级任务

On-Demand
ts
import { add } from 'protocol-launcher/2do'

const url = add({
  task: 'Important task',
  priority: 3,
})

添加带标签的任务

On-Demand
ts
import { add } from 'protocol-launcher/2do'

const url = add({
  task: 'Monthly subscription',
  tags: 'bill,payment',
})

添加任务到项目

On-Demand
ts
import { add } from 'protocol-launcher/2do'

const url = add({
  task: 'Buy a new charger',
  forParentName: 'Shopping List',
  forList: 'Home',
})

粘贴文本为任务

On-Demand
ts
import { paste } from 'protocol-launcher/2do'

const url = paste({
  text: 'Task 1\nTask 2\nTask 3',
  forList: 'Shopping',
})

获取任务 ID

On-Demand
ts
import { getTaskID } from 'protocol-launcher/2do'

const url = getTaskID({
  task: 'My Task',
  forList: 'Work',
  saveInClipboard: 1,
})