AppleSauce
    Preparing search index...

    Class EventFactory

    Base class that provides event creation functionality. This class can be extended by other packages to add additional helpful event creation methods.

    // In another package (e.g., applesauce-common)
    import { EventFactory } from "applesauce-core/event-factory";
    import { NoteBlueprint, ReactionBlueprint } from "applesauce-common/blueprints";

    // Add methods to the prototype
    EventFactory.prototype.note = function(content, options) {
    return this.create(NoteBlueprint, content, options);
    };

    EventFactory.prototype.reaction = function(event, emoji) {
    return this.create(ReactionBlueprint, event, emoji);
    };

    // Extend the type via module augmentation
    declare module "applesauce-core/event-factory" {
    interface EventFactory {
    note(content: string, options?: NoteBlueprintOptions): Promise<EventTemplate>;
    reaction(event: NostrEvent, emoji?: string): Promise<EventTemplate>;
    }
    }

    Implements

    Index

    Constructors

    Properties

    context: EventFactoryContext = {}

    Methods