Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@kody/doomPublic

src/open.ts

18 lines · 566 B · TypeScript
import { packageContext } from 'kody:runtime'

/**
 * Return the hosted KODOOM PWA URL for the current package mount.
 * Use when an agent or human needs a shareable link to the live game app.
 *
 * @returns Absolute hosted URL string
 *
 * @example
 * import open from 'kody:@kody/doom/open'
 * const url = await open()
 */
export default async function open(): Promise<string> {
	if (!packageContext?.hostedUrl) {
		throw new Error('This module must run as a package app or package context.')
	}
	return String(packageContext.hostedUrl).replace(/\/$/, '') + '/'
}