@dubsdotapp/expo 0.5.1 → 0.5.2
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useArcadeBridge.ts +6 -1
package/package.json
CHANGED
|
@@ -48,6 +48,9 @@ export interface UseArcadeBridgeOptions {
|
|
|
48
48
|
durationMs?: number,
|
|
49
49
|
) => Promise<SubmitScoreResult>;
|
|
50
50
|
|
|
51
|
+
/** Called when a new life starts (after startAttempt succeeds and session is injected) */
|
|
52
|
+
onPlayStarted?: () => void;
|
|
53
|
+
|
|
51
54
|
/** Called after a score is successfully submitted */
|
|
52
55
|
onScoreSubmitted?: (result: SubmitScoreResult) => void;
|
|
53
56
|
|
|
@@ -81,6 +84,7 @@ export function useArcadeBridge({
|
|
|
81
84
|
canPlay,
|
|
82
85
|
startAttempt,
|
|
83
86
|
submitScore,
|
|
87
|
+
onPlayStarted,
|
|
84
88
|
onScoreSubmitted,
|
|
85
89
|
onError,
|
|
86
90
|
}: UseArcadeBridgeOptions): UseArcadeBridgeResult {
|
|
@@ -114,13 +118,14 @@ export function useArcadeBridge({
|
|
|
114
118
|
gameStartTimeRef.current = Date.now();
|
|
115
119
|
setLastResult(null);
|
|
116
120
|
injectSession(result.sessionToken, result.attemptNumber);
|
|
121
|
+
onPlayStarted?.();
|
|
117
122
|
} catch (err) {
|
|
118
123
|
const e = err instanceof Error ? err : new Error(String(err));
|
|
119
124
|
onError?.(e);
|
|
120
125
|
} finally {
|
|
121
126
|
setBridgeLoading(false);
|
|
122
127
|
}
|
|
123
|
-
}, [canPlay, startAttempt, injectSession, onError]);
|
|
128
|
+
}, [canPlay, startAttempt, injectSession, onPlayStarted, onError]);
|
|
124
129
|
|
|
125
130
|
// ── handleMessage ─────────────────────────────────────────────────────────
|
|
126
131
|
const handleMessage = useCallback(
|