Skip to content

Map planner · Modules

1 module · 3 exports · 0 repositories · 0 e2e tests · 1 route

Who imports who · hover a node
Depends onMap planner modulesUsed byPlanImport3 exportsComponents2 files

PlanImport

app/features/map-planner/core/PlanImport.ts

Cross-tab handoff of a plan into the planner: the source tab stashes the plan in localStorage under a fresh key, then opens the planner with ?import=<key> (plus the stage and mode its header shows). Claimed plans are removed; unclaimed leftovers (blocked popup) are swept by key age next time.

Imports
no other modules
Used by
2 components

Types

interface

ImportedPlan

no JSDoc:19
export interface ImportedPlan {
	/** the canvas background, as a data URL so the saved plan outlives the page */
	background: string;
	/** main weapons placed beside the background */
	allies: MainWeaponId[];
	/** main weapons placed beside the background, outlined */
	enemies: MainWeaponId[];
}

Functions & values

function

openInNewTab

:36

Opens the planner in a new tab with the plan set up on its canvas, replacing what was there. Call from a user gesture. Rejects, opening nothing, when the plan can't be stashed (e.g. storage full).

export async function openInNewTab({
	background,
	allies,
	enemies,
	stageId,
	mode,
}: Omit<ImportedPlan, "background"> & {
	background: Blob;
	/** shown in the planner's header, null when unknown */
	stageId: StageId | null;
	mode: ModeShort | null;
}): Promise<void>
Unit tests (2)
function

claim

:73

Takes (and removes) the plan stashed under key. Null when there's none.

export function claim(key: string): ImportedPlan | null
Unit tests (4)