feat(airport): add the Hex Airport dispatch lab as a baseline snapshot
Six-side aprons, frozen levels, solver, rewards and verify scripts; the edge-runway readability work continues from here.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// The host adapter must return a completed receipt only after its rewarded-ad
|
||||
// success callback. No ad SDK or network service is bundled with this prototype.
|
||||
export async function requestReward(game, provider, isCurrent = () => true) {
|
||||
if (game.rewardPending || game.won || game.deadlocked || !isCurrent()) return { status: 'unavailable' };
|
||||
game.rewardPending = true;
|
||||
try {
|
||||
const receipt = await provider({ levelId: game.level.id, steps: game.level.reward.steps });
|
||||
if (!isCurrent()) return { status: 'stale' };
|
||||
return { status: game.grantReward(receipt) ? 'granted' : 'cancelled' };
|
||||
} catch { return { status: 'failed' }; }
|
||||
finally { game.rewardPending = false; }
|
||||
}
|
||||
Reference in New Issue
Block a user