JSPM

  • Created
  • Published
  • Downloads 2031
  • Score
    100M100P100Q99522F
  • License MIT

Core functionality for the Sharpee interactive fiction engine

Package Exports

  • @sharpee/core

Readme

@sharpee/core

Core types, interfaces, and utilities for the Sharpee Interactive Fiction platform.

Installation

npm install @sharpee/core

Overview

This package provides the foundational types used across all Sharpee packages:

  • Event System - SemanticEvent, typed event registry, event helpers
  • Query System - QueryManager for player input (yes/no, menus)
  • Platform Events - Save, restore, quit, restart handling
  • Core Utilities - Common interfaces and type definitions

Usage

import {
  SemanticEvent,
  createTypedEvent,
  isEventType,
  QueryManager,
  PlatformEventType
} from '@sharpee/core';

// Create typed events
const event = createTypedEvent('game.started', { timestamp: Date.now() });

// Type-safe event checking
if (isEventType(event, 'game.started')) {
  console.log(event.data.timestamp);
}

License

MIT