Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ModalService

Allows a poppy service to handle requests from a client

Hierarchy

  • ModalService

Index

Constructors

Methods

  • changeOrigin(newOrigin: string): void
  • Notify the client of a change in the service origin

    Clients only accept messages from the origin of the service loaded into the poppy. This method allows changing the origin before redirecting to a different service.

    Parameters

    • newOrigin: string

    Returns void

  • close(): void
  • Close the service

    Use this instead of window.close() to notify the client about the closing immediately (otherwise it will find out by polling to check the window status)

    Returns void

  • connectDirectly(side: "offering" | "accepting", form: string, having: object, exchangePort: MessagePort, statusPort: MessagePort): void
  • Low level interface allowing directly specifying the MessagePorts to use to perform the exchange

    Parameters

    • side: "offering" | "accepting"

      Side of the exchange

    • form: string

      Form of the exchange

    • having: object

      Form-specific metadata

    • exchangePort: MessagePort

      MessagePort to perform exchange over

    • statusPort: MessagePort

      MessagePort to send ["done"] status once exchange is complete

    Returns void

  • Listen for a client request

    This asynchronously waits for a client request and returns a promise that resolves to either the request (if one is detected) or undefined (after a timeout period of by default 1 second, the timeout parameter can change this)

    This method doesn't open the request and may be called any number of times, and from any number of different pages, until request.open() is called. After that, the exchange will be complete.

    Parameters

    • Optional timeout: number

      Optionally specify a timeout duration, the default if not is 1 second

    Returns Promise<undefined | ModalServiceRequest>

Generated using TypeDoc