libaribhtml5 0.1.0 → 0.1.1
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/dist/sdk/arib-vfs-sw.js
CHANGED
|
@@ -6,6 +6,47 @@
|
|
|
6
6
|
(_match, _quote, quoted, bare) => ` data-arib-romsound="${quoted ?? bare}"`
|
|
7
7
|
);
|
|
8
8
|
}
|
|
9
|
+
function createRuntimeBootstrap(scopePath = "/data-broadcast/") {
|
|
10
|
+
const basePath = normalizeBasePath(scopePath);
|
|
11
|
+
return `<script>
|
|
12
|
+
(function installAribHtml5Runtime(attempt) {
|
|
13
|
+
var install
|
|
14
|
+
try {
|
|
15
|
+
install = parent && parent.__ARIB_HTML5_INSTALL__
|
|
16
|
+
} catch (error) {
|
|
17
|
+
install = null
|
|
18
|
+
}
|
|
19
|
+
if (typeof install === 'function') {
|
|
20
|
+
try {
|
|
21
|
+
install(window)
|
|
22
|
+
return
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('ARIB HTML5 runtime installation failed', error)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!navigator.receiverDevice) {
|
|
28
|
+
Object.defineProperty(navigator, 'receiverDevice', {
|
|
29
|
+
configurable: true,
|
|
30
|
+
enumerable: true,
|
|
31
|
+
value: {
|
|
32
|
+
getSystemInformation: function () {
|
|
33
|
+
return {
|
|
34
|
+
browsername: 'unknown',
|
|
35
|
+
browserversion: 'unknown',
|
|
36
|
+
makerid: 'unknown',
|
|
37
|
+
modelname: 'unknown',
|
|
38
|
+
baseurl: new URL(${JSON.stringify(basePath)}, location.origin).href
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
if (attempt < 100) {
|
|
45
|
+
setTimeout(function () { installAribHtml5Runtime(attempt + 1) }, 50)
|
|
46
|
+
}
|
|
47
|
+
})(0)
|
|
48
|
+
<\/script>`;
|
|
49
|
+
}
|
|
9
50
|
function normalizeBasePath(value) {
|
|
10
51
|
const base = value || "/data-broadcast/";
|
|
11
52
|
return `/${base.replace(/^\/+|\/+$/g, "")}/`;
|
|
@@ -70,7 +111,7 @@
|
|
|
70
111
|
const CACHE_NAME = `libaribhtml5-arib-vfs-v1:${VFS_PREFIX}`;
|
|
71
112
|
const CACHE_RESOURCE_PATH = `${VFS_PREFIX}.libaribhtml5-arib-vfs-resource`;
|
|
72
113
|
const CACHE_SESSION_PATH = `${VFS_PREFIX}.libaribhtml5-arib-vfs-session`;
|
|
73
|
-
const RUNTIME_BOOTSTRAP =
|
|
114
|
+
const RUNTIME_BOOTSTRAP = createRuntimeBootstrap(VFS_PREFIX);
|
|
74
115
|
const resources = /* @__PURE__ */ new Map();
|
|
75
116
|
const waiters = /* @__PURE__ */ new Map();
|
|
76
117
|
let enabled = false;
|