- Docs
- mount()
mount()
Detailed Ticker API contract: mount()
Starts the shared page manager for declarative ticker markup.
Signature
import { mount } from '@samline/ticker/vanilla'
mount(): void
The package root also exports mount.
Behavior
When a DOM is available, mount():
- marks the manager mounted;
- waits for
DOMContentLoadedwhen the document is still loading, otherwise scans immediately; - initializes
[data-ticker]and.ticker-wrapperroots that contain a recognized track and content element; - observes
document.bodyfor inserted and removed ticker roots; - refreshes tracked tickers after
document.fonts.readyand windowload; - installs a window
resizefallback whenResizeObserveris unavailable; - initializes shared document-visibility and reduced-motion listeners when the first ticker starts.
These playback listeners also apply to standalone ticker() controllers and are removed when the last tracked ticker is destroyed.
Calls return without side effects when window or document is unavailable.
Required markup
<div data-ticker data-duration="24">
<div data-ticker-track>
<div data-ticker-content>...</div>
</div>
</div>
The class equivalents .ticker-wrapper, .ticker-track, and .ticker-content are also recognized.
Ownership
The manager and controller factory share runtime state. Do not call ticker() for a root already owned through declarative discovery. Call unmount() when the integration ends.