@leftium/gg 0.0.52 → 0.0.53
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/eruda/index.js +5 -9
- package/dist/gg.d.ts +14 -0
- package/dist/gg.js +16 -0
- package/package.json +1 -1
package/dist/eruda/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BROWSER } from 'esm-env';
|
|
2
2
|
import { shouldLoadEruda, loadEruda } from './loader.js';
|
|
3
|
+
import { enableGgRuntime } from '../gg.js';
|
|
3
4
|
let initialized = false;
|
|
4
5
|
/**
|
|
5
6
|
* Initialize the gg Eruda plugin
|
|
@@ -62,16 +63,11 @@ function setupGestureDetection(options) {
|
|
|
62
63
|
// Reset timer on each tap
|
|
63
64
|
if (tapTimer)
|
|
64
65
|
clearTimeout(tapTimer);
|
|
65
|
-
// If 5 taps detected, load Eruda
|
|
66
|
+
// If 5 taps detected, enable gg logging and load Eruda
|
|
66
67
|
if (tapCount >= 5) {
|
|
67
|
-
console.log('[gg] 5 taps detected, loading Eruda
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
localStorage.setItem('gg-enabled', 'true');
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// localStorage might not be available
|
|
74
|
-
}
|
|
68
|
+
console.log('[gg] 5 taps detected, enabling gg logging and loading Eruda (session-only). For persistent logging across app restarts, run: localStorage.setItem("gg-enabled", "true")');
|
|
69
|
+
// Enable gg runtime for this session (flips ggConfig.enabled in memory only)
|
|
70
|
+
enableGgRuntime();
|
|
75
71
|
loadEruda(options);
|
|
76
72
|
resetTaps();
|
|
77
73
|
return;
|
package/dist/gg.d.ts
CHANGED
|
@@ -91,6 +91,20 @@ export declare class GgChain<T> {
|
|
|
91
91
|
/** Flush the log immediately and return the passthrough value. */
|
|
92
92
|
get v(): T;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Enable gg logging at runtime (e.g., after 5-tap gesture in production).
|
|
96
|
+
* Flips the internal enabled flag so subsequent gg() calls start capturing.
|
|
97
|
+
* This is session-only — does not persist to localStorage, so the next
|
|
98
|
+
* page load / app launch starts with gg disabled again.
|
|
99
|
+
*
|
|
100
|
+
* To enable gg across app restarts (e.g., in a prod Tauri app), run this
|
|
101
|
+
* in the Eruda console instead:
|
|
102
|
+
* localStorage.setItem("gg-enabled", "true")
|
|
103
|
+
* Clear with: localStorage.removeItem("gg-enabled") or gg.clearPersist()
|
|
104
|
+
*
|
|
105
|
+
* @internal Used by the Eruda gesture handler — not part of the public API.
|
|
106
|
+
*/
|
|
107
|
+
export declare function enableGgRuntime(): void;
|
|
94
108
|
/**
|
|
95
109
|
* Chainable wrapper returned by gg.time(). Only supports .ns() for setting
|
|
96
110
|
* the namespace for the entire timer group (inherited by timeLog/timeEnd).
|
package/dist/gg.js
CHANGED
|
@@ -559,6 +559,22 @@ gg.clearPersist = () => {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
};
|
|
562
|
+
/**
|
|
563
|
+
* Enable gg logging at runtime (e.g., after 5-tap gesture in production).
|
|
564
|
+
* Flips the internal enabled flag so subsequent gg() calls start capturing.
|
|
565
|
+
* This is session-only — does not persist to localStorage, so the next
|
|
566
|
+
* page load / app launch starts with gg disabled again.
|
|
567
|
+
*
|
|
568
|
+
* To enable gg across app restarts (e.g., in a prod Tauri app), run this
|
|
569
|
+
* in the Eruda console instead:
|
|
570
|
+
* localStorage.setItem("gg-enabled", "true")
|
|
571
|
+
* Clear with: localStorage.removeItem("gg-enabled") or gg.clearPersist()
|
|
572
|
+
*
|
|
573
|
+
* @internal Used by the Eruda gesture handler — not part of the public API.
|
|
574
|
+
*/
|
|
575
|
+
export function enableGgRuntime() {
|
|
576
|
+
ggConfig.enabled = true;
|
|
577
|
+
}
|
|
562
578
|
// ── Console-like methods ───────────────────────────────────────────────
|
|
563
579
|
// Each public method (gg.warn, gg.error, etc.) has a corresponding internal
|
|
564
580
|
// method (gg._warn, gg._error, etc.) that accepts call-site metadata from
|