@oasiz/sdk 1.2.0 → 1.3.0

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/README.md CHANGED
@@ -35,6 +35,12 @@ oasiz.triggerHaptic("medium");
35
35
 
36
36
  // 5. Submit score when the game ends
37
37
  oasiz.submitScore(score);
38
+
39
+ // 6. Optionally surface console logs in-game while debugging
40
+ oasiz.enableLogOverlay({
41
+ enabled: new URLSearchParams(window.location.search).has("oasizLogs"),
42
+ collapsed: true,
43
+ });
38
44
  ```
39
45
 
40
46
  ---
@@ -128,6 +134,34 @@ Haptics are throttled internally (50ms cooldown) to prevent spam.
128
134
 
129
135
  ---
130
136
 
137
+ ## Debugging
138
+
139
+ ### `oasiz.enableLogOverlay(options?: LogOverlayOptions)`
140
+
141
+ Mount an opt-in in-game console viewer for local debugging, QA sessions, or creator support. It mirrors `console.log`, `console.info`, `console.warn`, `console.error`, and `console.debug` into a floating overlay inside the game iframe. The overlay can be collapsed, repositioned by dragging the top bar, and resized from the bottom-right corner while the action buttons remain clickable.
142
+
143
+ ```ts
144
+ const logOverlay = oasiz.enableLogOverlay({
145
+ enabled: new URLSearchParams(window.location.search).has("oasizLogs"),
146
+ collapsed: true,
147
+ });
148
+
149
+ console.log("[Boot] Scene ready");
150
+
151
+ // Optional cleanup if your game tears down and remounts
152
+ logOverlay.destroy();
153
+ ```
154
+
155
+ Options:
156
+ - `enabled`: defaults to `true`. Pass your own flag or query-param check here.
157
+ - `collapsed`: start with only the toggle pill visible.
158
+ - `maxEntries`: cap retained log lines. Defaults to `200`.
159
+ - `title`: optional label shown at the top of the panel. Defaults to `SDK Logs`.
160
+
161
+ The returned handle supports `show()`, `hide()`, `clear()`, `isVisible()`, and `destroy()`.
162
+
163
+ ---
164
+
131
165
  ## Game state persistence
132
166
 
133
167
  Persist cross-session data such as unlocked levels, inventory, or lifetime stats. State is stored per-user per-game in the Oasiz backend — available across devices and app reinstalls.
@@ -327,6 +361,7 @@ import {
327
361
  saveGameState,
328
362
  flushGameState,
329
363
  shareRoomCode,
364
+ enableLogOverlay,
330
365
  onPause,
331
366
  onResume,
332
367
  onBackButton,
@@ -344,7 +379,14 @@ import {
344
379
  ## TypeScript types
345
380
 
346
381
  ```ts
347
- import type { HapticType, ScoreConfig, ScoreAnchor, GameState } from "@oasiz/sdk";
382
+ import type {
383
+ GameState,
384
+ HapticType,
385
+ LogOverlayHandle,
386
+ LogOverlayOptions,
387
+ ScoreAnchor,
388
+ ScoreConfig,
389
+ } from "@oasiz/sdk";
348
390
  ```
349
391
 
350
392
  ---