Skip to content

Longshot

Longshot 是一款强大的 macOS 截图和录屏工具。Protocol Launcher 允许您生成深度链接以在 Longshot 中触发截图、录屏、OCR 等操作。

使用方式

有两种使用此库的方式:

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

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

选择安装方式

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

开始截图

On-Demand
ts
import { snip } from 'protocol-launcher/longshot'

const url = snip({
  func: 'start',
})

开始区域录屏

On-Demand
ts
import { record } from 'protocol-launcher/longshot'

const url = record({
  func: 'startArea',
})

开始 OCR 文字识别

On-Demand
ts
import { ocr } from 'protocol-launcher/longshot'

const url = ocr({
  func: 'start',
})

开始屏幕测量

On-Demand
ts
import { rule } from 'protocol-launcher/longshot'

const url = rule({
  func: 'start',
})

打开偏好设置

On-Demand
ts
import { pref } from 'protocol-launcher/longshot'

const url = pref({
  page: 'shortcuts',
})