# 背景与价值 - 将 Web 应用升级为系统文件处理器,提升编辑与打开流程的一致性。 # manifest 配置示例 ```json { "name": "示例编辑器", "start_url": "/", "display": "standalone", "file_handlers": [ { "action": "/open", "accept": { "application/json": [".json"], "text/markdown": [".md"], "image/png": [".png"] } } ] } ``` # 启动处理 ```ts if ('launchQueue' in window) { (window as any).launchQueue.setConsumer(async (params: any) => { if (!params.files?.length) return; for (const f of params.files) { const h = await f.getFile(); openInEditor(h); } }); } ``` # 指标验证(Chrome 128/Edge 130 + 安装 PWA) - 打开成功率:≥ 99%。 - 启动耗时(P95):≤ 800ms。 - 类型覆盖:预设类型与扩展名匹配率 100%。 # 回退策略 - 不支持环境:提供站内文件上传入口与拖拽打开;注册系统协议或助手应用。 # 测试清单 - 多类型与批量打开:文件内容正确加载;错误类型提示清晰。

发表评论 取消回复