# All files / src/utilities message-system.ts

100% Statements 6/6
100% Branches 4/4
100% Functions 2/2
100% Lines 6/6

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

    2x

    2x

    2x

    2x

    2x

    2x

     export interface ComponentData {
        /**
         * The id mapped to the component
         */
        id: string;

        /**
         * The props for the component
         */
        props: any;
    }

    export enum ViewerMessageType {
        /**
         * Initialize a component
         */
        initializeComponent = "initialize-component",

        /**
         * Update a components data
         */
        updateComponentData = "update-component-data",
    }

    export enum ViewerMessageTarget {
        /**
         * Target the parent viewer
         */
        viewer = "viewer",

        /**
         * Target the iframe contents ViewerContent component
         */
        viewerContent = "viewer-content",
    }

    export interface ViewerMessage {
        /**
         * The target of the message
         */
        target: ViewerMessageTarget;

        /**
         * The message type
         */
        type: ViewerMessageType;

        /**
         * The component data
         */
        componentData?: ComponentData[];
    }