furo-document-title

furo-document-title #

@furo/route v2.6.13
import '@furo/route/src/furo-document-title.js';
exports FuroDocumentTitle js
exports <furo-document-title> custom-element-definition
superclass LitElement
mixes FBP

summary Document title

furo-document-title

Updates the document title and set navigation waypoints.

Structure of the title #

The title is built up from 3 parts (prefix, title, suffix). Each of them can be set by attribute or a setter method. The title and suffix part can be set with a fieldnode from a furo-data-object.

document.title = prefix + title + suffix

Waypoints #

Waypoints are pushed to the browser history and allows you to navigate with the back and forward buttons of the browser. To return to the last waypoint within your app, you have to trigger a history.back(). Read more about the history API here.

If you use furo-app-flow you can send the history-back event.

Views and pages without a waypoint are not stored in the history.

[a]-->[b]-->[.]-->[.]-->[.]-->[c]
       ▲                       │
       └───────────────────────┘
       By clicking the back button you will return to b

Usage example #

1
2
3
4
5
6
 <furo-document-title
   prefix="${i18n.t('prefix.label')} ["
   fn-bind-title="--DataObject(*.display_name)"
   suffix="]"
   fn-set-waypoint="--pageActivated"
 ></furo-document-title>

The document title will be set to: PrefixLabel [display_name_value]

Attributes and Properties #

prefix #

prefix string default: ''

prefix part, you can also use setPrefix().`

title #

title string default: ''

Title part, you can also use setTitle() or bindTitle().

suffix #

suffix string default: ''

Suffix part, you can also use setSuffix() or bindSuffix().

Events #

waypoint-pushed #

at-waypoint-pushedEvent

Fired when the waypoint is finaly pushed to the browser history.

waypoint-canceled #

at-waypoint-canceledEvent

Fired when the waypoint was set but not pushed to the history, because the user navigated back.

Methods #

setWaypoint #

setWaypoint() ⟹ void

*fn-set-waypoint



activate #

activate() ⟹ void

*fn-activate

Set the document title with the current prefix title suffix. Without setting a waypoint.



setSuffix #

setSuffix(s `` ) ⟹ void

`` fn-set-suffix

Updates the suffix

  • s

setTitle #

setTitle(title `` ) ⟹ void

`` fn-set-title

Updates the title

  • title string

bindSuffix #

bindSuffix(fieldnode `` ) ⟹ void

`` fn-bind-suffix

Bind a fieldnode to auto update the suffix

  • fieldnode

bindTitle #

bindTitle(fieldnode `` ) ⟹ void

`` fn-bind-title

Bind a fieldnode to auto update the title

  • fieldnode