Options
All
  • Public
  • Public/Protected
  • All
Menu

apollo-link-preload

Index

Variables

Const DIRECTIVE_NAME

DIRECTIVE_NAME: "preload" = "preload"

Functions

composePath

  • composePath(previous: string, current: string): string
  • Compose a path with delimiter.

    Parameters

    • previous: string
    • current: string

    Returns string

getAnnotatedFieldPaths

  • getAnnotatedFieldPaths(query: DocumentNode, directiveName?: string): string[]
  • Gets all field node paths with directives used for annotation.

    Parameters

    • query: DocumentNode

      document node of query

    • Default value directiveName: string = DIRECTIVE_NAME

    Returns string[]

hasDirectiveAnnotation

  • hasDirectiveAnnotation(fieldNode: FieldNode, directiveName: string): boolean
  • Checks wether a field has a specific directive annotation for given name.

    Parameters

    • fieldNode: FieldNode

      field node

    • directiveName: string

      directive name

    Returns boolean

preloadImage

  • preloadImage(src: string): Promise<void>
  • Function to preload an image into the browser cache.

    Parameters

    • src: string

      source of the image.

    Returns Promise<void>

walkASTForDirectivePaths

  • walkASTForDirectivePaths(selectionSet: keyof SelectionNode[], directiveName: string, previousPath?: string): string[]
  • Walks the field node's selection set to collect paths with directive annotations. Paths returned are of following pattern: 'field(.subfield)*.annotatedField'

    Parameters

    • selectionSet: keyof SelectionNode[]

      selection set

    • directiveName: string
    • Default value previousPath: string = ""

      previous

    Returns string[]

Generated using TypeDoc