Hookmark
Hookmark 是一款 macOS 应用程序,可让您在文件、电子邮件、网页等之间创建上下文书签和双向链接。Protocol Launcher 允许您生成深度链接以在 Hookmark 中打开资源。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
打开 Hookmark
ts
import { open } from 'protocol-launcher/hookmark'
const url = open()打开通讯录
ts
import { openAddressBook } from 'protocol-launcher/hookmark'
const url = openAddressBook()打开电子邮件
ts
import { openEmail } from 'protocol-launcher/hookmark'
const url = openEmail({
id: '<CABc123xyz@mail.gmail.com>',
})打开文件
ts
import { openFile } from 'protocol-launcher/hookmark'
const url = openFile({
path: '/Applications',
name: 'Applications',
})打开备忘录
ts
import { openNotes } from 'protocol-launcher/hookmark'
const url = openNotes()打开搜索
ts
import { openSearch } from 'protocol-launcher/hookmark'
const url = openSearch({
query: 'project',
})打开 Spotify
ts
import { openSpotify } from 'protocol-launcher/hookmark'
const url = openSpotify()