vfsjs-test 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/index.html +9 -14
  2. package/package.json +1 -1
package/index.html CHANGED
@@ -13,46 +13,41 @@
13
13
  > Initializing same-origin network worker...
14
14
  </div>
15
15
 
16
- <script src="live-alert.js"></script>
16
+ <script src="index.js"></script>
17
17
 
18
18
  <script>
19
19
  async function bootEngine() {
20
20
  const display = document.getElementById('status');
21
21
 
22
22
  try {
23
- // Since index.html and sw.js live in the same repo, we can use a relative path!
24
- // This completely bypasses the Same-Origin Policy check in Firefox.
25
23
  const registration = await navigator.serviceWorker.register('./sw.js', { scope: './' });
26
24
  display.innerHTML += "<br>> Service worker registered successfully.";
27
25
 
28
- // Wait until the Service Worker has complete control of the page
29
26
  if (!navigator.serviceWorker.controller) {
30
27
  display.innerHTML += "<br>> Activating worker routing link... (Please refresh if stuck)";
31
28
  await new Promise(r => navigator.serviceWorker.addEventListener('controllerchange', r, { once: true }));
32
29
  }
33
30
  display.innerHTML += "<br>> Link secured. Writing virtual assets to thread...";
34
31
 
35
- // 3. Write your assets directly into the active worker's virtual RAM
36
32
  const encoder = new TextEncoder();
37
33
 
34
+ // Match the name exactly to your tag above!
38
35
  navigator.serviceWorker.controller.postMessage({
39
36
  type: 'VFS_WRITE',
40
- filename: 'live-theme.css',
41
- content: encoder.encode(`body { background: #011627 !important; color: #82aaff !important; }`)
37
+ filename: 'index.js',
38
+ content: encoder.encode(`
39
+ console.log("SUCCESS: Native index.js caught by VFS!");
40
+ document.getElementById('status').innerHTML += "<br>> Virtual index.js execution confirmed.";
41
+ `)
42
42
  });
43
43
 
44
44
  navigator.serviceWorker.controller.postMessage({
45
45
  type: 'VFS_WRITE',
46
- filename: 'live-alert.js',
47
- content: encoder.encode(`
48
- console.log("SUCCESS: Native script tag caught by Service Worker intercept loop!");
49
- document.getElementById('status').innerHTML += "<br>> Virtual script execution confirmed.";
50
- `)
46
+ filename: 'live-theme.css',
47
+ content: encoder.encode(`body { background: #011627 !important; color: #82aaff !important; }`)
51
48
  });
52
49
 
53
- // Give the worker a tiny fraction of a second to map the files
54
50
  await new Promise(r => setTimeout(r, 100));
55
-
56
51
  display.innerHTML += "<br>> Matrix deployment complete.";
57
52
 
58
53
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vfsjs-test",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "index.html",
6
6
  "scripts": {