Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Core

Hierarchy

  • Core

Index

Properties

Logger

Logger: Logger = Logger

Logger class, allows plugins to create Logger.

Private _data

Private _linkEvent

_linkEvent: LinkEvent

Private _requestCustomError

_requestCustomError: RequestCustomError

Private _wrapper

_wrapper: Wrapper

cache

cache: Cache

Modules.

cacheFirstPage

cacheFirstPage: boolean

cacheIgnore

cacheIgnore: IgnoreOption

dom

dom: Dom = dom

Utils.

headers

headers: Headers

helpers

helpers: core/src/utils = helpers

history

history: History = history

hooks

hooks: Hooks = hooks

Hooks

logger

logger: Logger = new Logger('@barba/core')

Barba logger.

plugins

plugins: IBarbaPlugin<any>[] = []

Plugins.

prefetchIgnore

prefetchIgnore: IgnoreOption

prevent

prevent: Prevent

preventRunning

preventRunning: boolean

request

request: request = request

schemaPage

schemaPage: ISchemaPage = schemaPage

Schemas.

timeout

timeout: number

Options

transitions

transitions: Transitions

url

url: core/src/utils = url

version

version: string = version

Version.

views

views: Views

Accessors

data

wrapper

  • get wrapper(): HTMLElement

Methods

Private _bind

  • _bind(): void

Private _getLinkElement

Private _onLinkClick

Private _onLinkEnter

Private _onStateChange

  • _onStateChange(e: PopStateEvent): void
  • When History state changes.

    Get "href" from URL Go for a Barba transition.

    Parameters

    • e: PopStateEvent

    Returns void

Private _resetData

  • _resetData(): void

Private _unbind

  • _unbind(): void

destroy

  • destroy(): void

force

  • force(href: string): void

go

  • go(href: string, trigger?: Trigger, e?: LinkEvent | PopStateEvent): Promise<void>
  • Manage "self page" href:

    • if same url and no self transition, keep default behavior
      • link: reload the page
      • anchor: scroll to
    • if same url with self transition, use it
    • then start a page transition.

    Parameters

    • href: string
    • Default value trigger: Trigger = "barba"
    • Optional e: LinkEvent | PopStateEvent

    Returns Promise<void>

init

  • init(__namedParameters?: Object): void
  • See IBarbaOptions for more details.

    Default values are:

    • transitions: []
    • views: []
    • schema: [[SchemaAttribute]]
    • timeout: 2e3
    • cacheIgnore: false
    • cacheFirstPage: false
    • prefetchIgnore: false
    • preventRunning: false
    • prevent: null,
    • debug: false
    • logLevel: 'off'

    Parameters

    • Default value __namedParameters: Object = {}

    Returns void

onRequestError

  • onRequestError(trigger: Trigger, ...args: any): boolean
  • When a request error occurs.

    Allow the user to manage request error. (E.g: 404)

    Parameters

    • trigger: Trigger
    • Rest ...args: any

    Returns boolean

once

page

  • page(href: string, trigger: Trigger, event: LinkEvent | PopStateEvent, self: boolean): Promise<void>
    1. If no running transition, updates data with full URL properties and trigger.
    2. Get page from cache or init request.
    3. Wait if some transitions need "next" data (sync: true, to: …).
    4. Manage the history, depending on trigger.
    5. Get "data" and trigger "go" hook.
    6. Get the "resolved" transition from the store and start it.
    7. Update title and reset data (current, next = undefined).

    If "self", use the "self" transition

    Parameters

    Returns Promise<void>

prefetch

  • prefetch(href: string): void

use

Generated using TypeDoc