@sublane/core 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime.ts +9 -7
package/package.json
CHANGED
package/src/runtime.ts
CHANGED
|
@@ -57,14 +57,16 @@ export function createVideoSubtitleFramework({ ctx, plugins, storage: storagePor
|
|
|
57
57
|
* 只能靠存储变更事件才恢复——而卡死场景恰恰没有事件。降阶后有限退避重读,SW 恢复
|
|
58
58
|
* 即自动点亮,无需用户刷新)。 */
|
|
59
59
|
let readDegraded = false
|
|
60
|
+
// 诊断标记:仅浏览器环境写 dataset(框架零 DOM 约束;node:test 无 document)。
|
|
61
|
+
// 作用域必须在工厂体:recoverDegradedRead 亦引用之——曾定义在 readConfig 体内,
|
|
62
|
+
// 自愈首轮即 ReferenceError 崩死(空配置永久化,VA 真机实证),0.1.3 修复。
|
|
63
|
+
const mark = (name: string) => {
|
|
64
|
+
if (typeof document === 'undefined') return
|
|
65
|
+
const el = document.documentElement
|
|
66
|
+
el.dataset.sublaneBoot = `${el.dataset.sublaneBoot ?? ''}|rc:${name}`.slice(-400)
|
|
67
|
+
}
|
|
60
68
|
|
|
61
69
|
async function readConfig(): Promise<FrameworkConfig> {
|
|
62
|
-
// 诊断标记:仅浏览器环境写 dataset(框架零 DOM 约束;node:test 无 document)
|
|
63
|
-
const mark = (name: string) => {
|
|
64
|
-
if (typeof document === 'undefined') return
|
|
65
|
-
const el = document.documentElement
|
|
66
|
-
el.dataset.sublaneBoot = `${el.dataset.sublaneBoot ?? ''}|rc:${name}`.slice(-400)
|
|
67
|
-
}
|
|
68
70
|
mark('get-begin')
|
|
69
71
|
// 存储端口是可靠性单点(中继 Port 可能因 SW 冷启动/休眠变僵尸:请求无应答且不触发
|
|
70
72
|
// onDisconnect;或 SW 断线瞬间请求在途被 reject)。单次读取限时 1.5s,超时或拒绝均
|
|
@@ -146,7 +148,7 @@ export function createVideoSubtitleFramework({ ctx, plugins, storage: storagePor
|
|
|
146
148
|
const settingsChanged = JSON.stringify(run.config.settings) !== JSON.stringify(next.settings)
|
|
147
149
|
if (laneChanged || settingsChanged) {
|
|
148
150
|
run.config = next
|
|
149
|
-
try { run.instance.setConfig(next) } catch (error) { log(`[${plugin.id}] setConfig 失败:${error
|
|
151
|
+
try { run.instance.setConfig(next) } catch (error: unknown) { log(`[${plugin.id}] setConfig 失败:${error instanceof Error ? error.message : error}`) }
|
|
150
152
|
}
|
|
151
153
|
})
|
|
152
154
|
}
|