简体中文
Timepage
Timepage 是一款用于管理日程、事件和天气的日历应用。Protocol Launcher 可以生成官方 Timepage URL scheme 链接。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
打开 Timepage
ts
import { open } from 'protocol-launcher/timepage'
const url = open()添加事件
ts
import { addEvent } from 'protocol-launcher/timepage'
const url = addEvent({
title: 'Team Sync',
day: 'today',
})只有在需要 Timepage 官方 x-callback-url 形式时,才传入 x-success 或 x-cancel:
ts
import { addEvent } from 'protocol-launcher/timepage'
const url = addEvent({
title: 'Team Sync',
day: 'tomorrow',
xSuccess: 'shortcuts://callback',
xCancel: 'shortcuts://cancel',
})打开事件
ts
import { openEvent } from 'protocol-launcher/timepage'
const url = openEvent({
event: 'next',
})打开事件地图
ts
import { openEventMap } from 'protocol-launcher/timepage'
const url = openEventMap({
event: 'next',
})打开日期
ts
import { openDay } from 'protocol-launcher/timepage'
const url = openDay({
day: '2026-03-30',
})打开周
ts
import { openWeek } from 'protocol-launcher/timepage'
const url = openWeek({
week: 'this',
})官方 index 参数也支持数字偏移量:
ts
import { openWeek } from 'protocol-launcher/timepage'
const url = openWeek({
week: -1,
})打开月份
ts
import { openMonth } from 'protocol-launcher/timepage'
const url = openMonth({
month: 'next',
})打开天气
ts
import { openWeather } from 'protocol-launcher/timepage'
const url = openWeather({
day: 'today',
})ts
import { openWeather } from 'protocol-launcher/timepage'
const url = openWeather({
week: 'next',
})搜索
ts
import { search } from 'protocol-launcher/timepage'
const url = search({
query: 'project review',
})获取事件
ts
import { getEvent } from 'protocol-launcher/timepage'
const url = getEvent({
event: 'next',
xSuccess: 'shortcuts://callback',
})Timepage 会调用 x-success 回调,并带上 start、end、title 和 location 参数。
参考资料
获取路线
获取下一个活动或指定活动 ID 的路线。
ts
import { getDirections } from 'protocol-launcher/timepage'
const url = getDirections({
event: 'next'
})联系参与者
打开活动参与者的消息界面。
ts
import { messageAttendees } from 'protocol-launcher/timepage'
const url = messageAttendees({
event: 'next'
})分享倒计时
打开活动倒计时分享界面。
ts
import { countdownShare } from 'protocol-launcher/timepage'
const url = countdownShare({
event: 'next'
})打开 Actions
通过 Timepage 打开配套的 Actions 应用。
ts
import { openActions } from 'protocol-launcher/timepage'
const url = openActions()列出日历
通过 x-success 返回日历名称。writable: true 会生成 writable=1,只查询可写日历。
ts
import { listCalendars } from 'protocol-launcher/timepage'
const url = listCalendars({
xSuccess: 'myapp://x-callback-url/calendars',
writable: true
})