Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Frame

Index

Constructors

constructor

  • new Frame(connection: ClientConnection, win?: Window): Frame
  • Use in order to control the re-sizing of the Extension

    Parameters

    • connection: ClientConnection

      message-event-channel connection

    • Default value win: Window = window

      override the default window object

    Returns Frame

Properties

Private connection

connection: ClientConnection

message-event-channel connection

isAutoResizing

isAutoResizing: boolean = false

Private observer

observer: MutationObserver = new MutationObserver(() => this.updateHeight())

Private Optional previousHeight

previousHeight: undefined | number

Private updateHeightHandler

updateHeightHandler: () => void

Type declaration

    • (): void
    • Returns void

Private win

win: Window

override the default window object

Methods

getHeight

  • getHeight(): number
  • Get the height of the Extension

    Returns the extensions total height

    Example

    const height = sdk.frame.getHeight()
    
    // 200
    console.log(height)
    

    Returns number

setHeight

  • setHeight(height?: undefined | number): void
  • Set the height of the frame to the height of the Extension. Can optionally override the measured height with a defined value.

    Parameters

    • Optional height: undefined | number

      should be used if you want to override the calculated height of your extension

      If no height is passed it will try get the extension height or default to 0

      Example

      // sets height to extension height
      sdk.frame.setHeight()
      // sets height to 200
      sdk.frame.setHeight(200)
      

    Returns void

startAutoResizer

  • startAutoResizer(): void
  • Starts the auto-resizer

    It creates an event listener on resize and creates a mutation observer that updates the height when the body height changes you should clean up from this function on unmount to avoid memory leaks

    If called when already active it does nothing

    Example

    sdk.frame.startAutoResizer();
    

    Returns void

stopAutoResizer

  • stopAutoResizer(): void
  • Stops the auto-resizer

    It tears down the event listeners and observers created from startAutoResizer should be called when you want to mannaully handle the height or when unmounting

    If called without autoResizer being active it does nothing

    Example

    sdk.frame.stopAutoResizer();
    

    Returns void

Private updateHeight

  • updateHeight(): void

Legend

  • Constructor
  • Property
  • Method
  • Private property
  • Private method
  • Property
  • Inherited property
  • Protected property

Generated using TypeDoc