@narando/event-types
    TypeScript icon, indicating that this package has built-in type declarations

    0.36.1 • Public • Published

    @narando/event-types

    Helps handle narando events type safe.

    Related packages are @narando/event-consumer and @narando/event-producer.

    Getting Started

    You need to have nodejs and npm installed.

    $ npm install @narando/event-types

    Usage

    import {
      NarandoEvent,
      ArticleCreatedSoundFileEvent,
      isArticleCreatedSoundFileEvent,
    } from "@narando/event-types";
    
    // Use type predicated to select specific events
    function handleEvent(event: NarandoEvent) {
      if (isArticleCreatedSoundFileEvent(event)) {
        // event is ArticleCreatedSoundFileEvent
        event.msg.target.soundFileId;
      }
    
      // event is generic NarandoEvent
    }
    
    // Type-safe event handling
    function handleArticleCreatedSoundFileEvent(
      event: ArticleCreatedSoundFileEvent
    ) {}

    Development

    As this package is part of the toolkit monorepo, please refer to the top-level README to learn about hacking on this package.

    Keywords

    none

    Install

    npm i @narando/event-types

    DownloadsWeekly Downloads

    9

    Version

    0.36.1

    License

    UNLICENSED

    Unpacked Size

    7.01 kB

    Total Files

    17

    Last publish

    Collaborators

    • narandosystem
    • marcmogdanz
    • apricote
    • brandolpho