Options
All
  • Public
  • Public/Protected
  • All
Menu

Creates a barbajs based PJAX Service, for the native framework Based on barbajs and StartingBlocks

Hierarchy

Index

Constructors

constructor

Properties

app

app: IApp

The App the ManagerItem is attached to

config

config: ICONFIG

The Config of the App the ManagerItem is attached to

emitter

emitter: EventEmitter

The EventEmitter of the App the ManagerItem is attached to

forceOnError

forceOnError: boolean

Force load a page if an error occurs

ignoreHashAction

ignoreHashAction: boolean

Ignore hash action if set to true

isTransitioning

isTransitioning: boolean

Current state of transitions

key

key: any

The key to where ManagerItem is stored in an AdvancedManager

manager

The AdvancedManager the ManagerItem is attached to

onTransitionPreventClick

onTransitionPreventClick: boolean

Ignore extra clicks of an anchor element if a transition has already started

prefetchIgnore

prefetchIgnore: boolean | TypeIgnoreURLsList

URLs to ignore when prefetching / Whether or not to disable prefetching

preventURLs

preventURLs: boolean | TypeIgnoreURLsList

URLs to disable PJAX for

stickyScroll

stickyScroll: boolean

On page change (excluding popstate events) keep current scroll position

Methods

boot

  • boot(): void
  • Starts the PJAX Service

    Returns void

force

  • force(href: string): void
  • Force a page to go to a certain URL

    Parameters

    • href: string

    Returns void

getDirection

  • Returns the direction of the State change as a String, either the Back button or the Forward button

    Parameters

    • value: number

    Returns TypeTrigger

getHref

  • getHref(el: HTMLAnchorElement): string
  • Returns the href of an Anchor element

    Parameters

    • el: HTMLAnchorElement

    Returns string

  • Check if event target is a valid anchor with an href, if so, return the anchor

    Parameters

    Returns HTMLAnchorElement

getTransitionName

  • getTransitionName(el: HTMLAnchorElement): string
  • Gets the transition to use for a certain anchor

    Parameters

    • el: HTMLAnchorElement

    Returns string

go

  • If transition is running force load page. Stop if currentURL is the same as new url. On state change, change the current state history, to reflect the direction of said state change Load page and page transition.

    Parameters

    Returns Promise<void>

init

  • init(): void
  • Called before the start of a Service, represents a constructor of sorts

    Returns void

initEvents

  • initEvents(): void
  • Initialize DOM Events

    Returns void

install

  • install(): void
  • Run after the Manager Item has been registered

    Returns void

load

  • load(__namedParameters: { href: string; oldHref: string; scroll?: { x: number; y: number }; transitionName?: string; trigger?: TypeTrigger }): Promise<any>
  • Load the new Page as well as a Transition; starts the Transition

    Parameters

    • __namedParameters: { href: string; oldHref: string; scroll?: { x: number; y: number }; transitionName?: string; trigger?: TypeTrigger }
      • href: string
      • oldHref: string
      • Optional scroll?: { x: number; y: number }
        • x: number
        • y: number
      • Optional transitionName?: string
      • Optional trigger?: TypeTrigger

    Returns Promise<any>

onClick

  • When an element is clicked, get valid anchor element, go for a transition

    Parameters

    Returns void

onHover

  • When you hover over an anchor, prefetch the event target's href

    Parameters

    Returns Promise<void>

onStateChange

  • onStateChange(event: PopStateEvent): void
  • When History state changes, get url from State, go for a Transition.

    Parameters

    • event: PopStateEvent

    Returns void

register

stop

  • stop(): void
  • Stop Service

    Returns void

stopEvents

  • stopEvents(): void
  • Stop DOM Events

    Returns void

transitionStart

  • transitionStart(): void
  • Sets the transition state to either true or false

    Returns void

transitionStop

  • transitionStop(): void
  • Returns void

uninstall

  • uninstall(): any
  • Run before the ManagerItem has been unregistered

    Returns any

unregister

  • unregister(): void
  • Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager

    Returns void

  • validLink(el: HTMLAnchorElement, event: TypeLinkEvent | KeyboardEvent, href: string): boolean
  • Checks to see if the anchor is valid

    Parameters

    • el: HTMLAnchorElement
    • event: TypeLinkEvent | KeyboardEvent
    • href: string

    Returns boolean

Generated using TypeDoc