Timer+
Timer+ 是一款 iOS 计时器与秒表应用。Protocol Launcher 允许您生成官方 URL scheme 链接,在 Timer+ 中启动 quick timer 和 quick stopwatch。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
启动 Quick Timer
ts
import { quickTimer } from 'protocol-launcher/timer-plus'
const url = quickTimer({
minutes: 50,
name: 'Laundry',
})Timer+ 支持任意组合 hours、minutes 和 seconds。官方文档说明总时长最多 100 小时;如果省略时长,或时长合计为 0,会打开新的 Quick Timer 编辑界面。
启动带时分秒的 Quick Timer
ts
import { quickTimer } from 'protocol-launcher/timer-plus'
const url = quickTimer({
hours: 1,
minutes: 23,
seconds: 45,
})启动 Quick Stopwatch
ts
import { quickStopwatch } from 'protocol-launcher/timer-plus'
const url = quickStopwatch({
name: 'Plank',
})x-callback-url
Timer+ 部分支持 x-callback-url。官方文档只接受 x-source 和 x-success,并使用 timerplus://x-callback-url/ 前缀替代 timerplus://app/。
ts
import { quickTimer } from 'protocol-launcher/timer-plus'
const url = quickTimer({
hours: 1,
minutes: 5,
seconds: 30,
name: 'Tea',
xSource: 'Shortcuts',
xSuccess: 'shortcuts://callback',
})ts
import { quickStopwatch } from 'protocol-launcher/timer-plus'
const url = quickStopwatch({
name: 'Plank',
xSource: 'Shortcuts',
xSuccess: 'shortcuts://callback',
})