castle-web-sdk 0.4.14 → 0.4.15

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/dist/runtime.js +19 -3
  2. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -28,6 +28,21 @@ export function setup() {
28
28
  initHostCapture();
29
29
  initPlaySelection();
30
30
  initPlayCard();
31
+ logPanelLoad();
32
+ }
33
+ // Every panel boot leaves a line, so a reload from ANY cause shows up -- a load
34
+ // with no preceding reason line is one we do not yet explain.
35
+ function panelTag() {
36
+ try {
37
+ const q = new URLSearchParams(location.search);
38
+ return q.get("panel") || q.get("file") || "deck";
39
+ }
40
+ catch {
41
+ return "deck";
42
+ }
43
+ }
44
+ function logPanelLoad() {
45
+ setTimeout(() => console.log(`[reload] ${panelTag()} LOADED`), 0);
31
46
  }
32
47
  export function writeFile(path, contents) {
33
48
  return sendLocalRequest({
@@ -501,7 +516,7 @@ function handleLocalMessage(msg) {
501
516
  });
502
517
  }
503
518
  else if (msg.type === "restart") {
504
- scheduleReload(RESTART_DEBOUNCE_MS);
519
+ scheduleReload(RESTART_DEBOUNCE_MS, "restart message");
505
520
  }
506
521
  else if (msg.type === "files_changed") {
507
522
  dispatchFilesChanged(msg);
@@ -610,9 +625,10 @@ function stashReloadState() {
610
625
  // Reload this page after honoring the save hooks. Consumers call this when a
611
626
  // files-changed event tells them code they run on has changed.
612
627
  export function requestReload() {
613
- scheduleReload(REQUEST_RELOAD_DEBOUNCE_MS);
628
+ scheduleReload(REQUEST_RELOAD_DEBOUNCE_MS, "requestReload");
614
629
  }
615
- function scheduleReload(delayMs) {
630
+ function scheduleReload(delayMs, reason = "unknown") {
631
+ console.log(`[reload] ${panelTag()} scheduling reload (${reason})`);
616
632
  if (restartTimer !== null)
617
633
  clearTimeout(restartTimer);
618
634
  restartTimer = setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-sdk",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "type": "module",
5
5
  "main": "dist/castle.js",
6
6
  "types": "dist/castle.d.ts",