Utils

Barba is brought to you with a bunch of useful utilities.

  • barba.version → Retrieve the current @barba/core version
  • barba.destroy()Destroy the Barba instance and properly remove EventListener on eligible links
  • barba.go(href: string, trigger?: Trigger, e?: LinkEvent | PopStateEvent) → Tell Barba to go to a specific URL and play your transitions, if available, without using a browser “force reload”
  • barba.force(href: string) → Force Barba to redirect to a specific URL without playing your transitions, equivalent to location.href change
  • barba.prefetch(href: string) → Prefetch the given URL, see prefetch strategy
  • barba.url.parse(url: string) → Parse the given URL and retrieve a IUrlBase
  • barba.history.previous → Get the previous history object, see history strategy
  • barba.history.current → Get the current history object, see history strategy
  • barba.history.add(url: string, trigger: Trigger, action?: HistoryAction) → Push or replace a new state in the browser history, see history strategy
  • barba.cache.get(url: string) → Get cache data for a given URL and retrieve action, request, status and target

This is a draft section of @barba/core utilities that shows the most important you could use in your project, check the Developer API for more informations.