Skip to content

onFollowChange

Hears a timeline that follows the present (timeline.follow) pause or take it up again.

Type(following: boolean) => void
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/settings.ts

It receives false when following pauses — the person scrolled, slid or went to another period — and true when it is taken up again: “Today” (navigate('today')) or update({ timeline: { follow: true } }). Turning follow off by update() is said too; the option as the calendar first reads it is not. Made for a supervision screen: a “Back to live” button shown while paused.

import { createCalendar } from '@dzcalendar/dom';
import '@dzcalendar/pro';
const live = document.querySelector<HTMLButtonElement>('#live')!;
const calendar = createCalendar(element, {
timeZone: 'Europe/Paris',
initialView: 'resourceTimelineDay',
resources: [{ id: 'import', title: 'Import' }, { id: 'billing', title: 'Billing' }],
timeline: { slot: 15, span: { hours: 4 }, follow: true },
// Paused: the button appears; back to live, it goes.
onFollowChange: (following) => (live.hidden = following),
});
live.addEventListener('click', () => calendar.navigate('today'));

In Angular and Vue it goes in options; in React it is a prop.