Skip to content

MLScrollytelling

Defined in: packages/core/src/components/ml-scrollytelling.ts:150

The <ml-scrollytelling> custom element.

Dispatched on the element as CustomEvents; listen with addEventListener.

EventWhen
ml-scrollytelling:chapterA chapter became active
ml-scrollytelling:actionA custom chapter action ran
ml-scrollytelling:errorThe story could not be loaded or validated
  • BaseElement

new MLScrollytelling(): MLScrollytelling

Defined in: packages/core/src/components/ml-scrollytelling.ts:196

MLScrollytelling

BaseElement.constructor

get activeChapterId(): string | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:320

The active chapter’s id, or null.

string | null


get base(): string | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:281

Where the story’s own paths start: reflects the base attribute; null when unset. Same semantics as <ml-map base>: with a base, src, every path in the story’s map document (sources, images, marker icons, style) and chapter image/video paths resolve against it; full URLs are never changed. Handed to the story’s <ml-map>.

string | null

set base(value): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:285

ParameterType
valuestring | null

void


get config(): {[key: string]: any; } | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:311

Alias of story, mirroring <ml-map>’s config.

{[key: string]: any; } | null

set config(value): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:315

ParameterType
valuestring | {[key: string]: any; } | null

void


get mapElement(): MLMap | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:325

The story’s <ml-map>, once the story has rendered.

MLMap | null


get story(): {[key: string]: any; } | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:291

The validated story, or null before one loads (or after it failed).

{[key: string]: any; } | null

set story(value): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:301

Show a story: a type: scrollytelling object or document text (YAML, JSON or TOML). It is validated like every other path. Assigning a value JSON-equal to the one shown, or the same text again, is a no-op. While text is being read, this is still the story shown.

ParameterType
valuestring | {[key: string]: any; } | null

void


get static observedAttributes(): string[]

Defined in: packages/core/src/components/ml-scrollytelling.ts:151

string[]

addEventListener<K>(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1348

Type Parameter
K extends keyof MLScrollytellingEventMap
ParameterType
typeK
listener(this, event) => unknown
options?boolean | AddEventListenerOptions

void

BaseElement.addEventListener

addEventListener<K>(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1353

Type Parameter
K extends keyof HTMLElementEventMap
ParameterType
typeK
listener(this, event) => unknown
options?boolean | AddEventListenerOptions

void

BaseElement.addEventListener

addEventListener(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1358

ParameterType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | AddEventListenerOptions

void

BaseElement.addEventListener


attributeChangedCallback(name, oldValue, newValue): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:423

ParameterType
namestring
oldValuestring | null
newValuestring | null

void


connectedCallback(): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:399

void


disconnectedCallback(): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:417

void


getGrid(sourceId): GridField | undefined

Defined in: packages/core/src/components/ml-scrollytelling.ts:347

A type: grid source’s field on the story’s map (grid source, R14), or undefined before it is decoded.

ParameterType
sourceIdstring

GridField | undefined


getMap(): maplibregl.Map | null

Defined in: packages/core/src/components/ml-scrollytelling.ts:330

The story’s MapLibre map, or null before it has loaded.

maplibregl.Map | null


goToChapter(chapterId): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:373

Scroll to a chapter and make it active at once (the rail’s click). The chapters scrolled past on the way are skipped.

ParameterType
chapterIdstring

void


gridReady(sourceId): Promise<GridField>

Defined in: packages/core/src/components/ml-scrollytelling.ts:363

Resolve with a type: grid source’s field on the story’s map once it is decoded (R14); before the story has rendered, once it has a map. Rejects as <ml-map>’s does, and when the story fails.

ParameterType
sourceIdstring

Promise<GridField>


hasGrid(sourceId): boolean

Defined in: packages/core/src/components/ml-scrollytelling.ts:353

Whether the story’s map has a type: grid source of this id (decoded or not); false before the map has loaded.

ParameterType
sourceIdstring

boolean


mapReady(): Promise<maplibregl.Map>

Defined in: packages/core/src/components/ml-scrollytelling.ts:339

Resolve with the story’s MapLibre map once it has loaded; reject if the story or its map fails.

Promise<maplibregl.Map>


removeEventListener<K>(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1363

Type Parameter
K extends keyof MLScrollytellingEventMap
ParameterType
typeK
listener(this, event) => unknown
options?boolean | EventListenerOptions

void

BaseElement.removeEventListener

removeEventListener<K>(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1368

Type Parameter
K extends keyof HTMLElementEventMap
ParameterType
typeK
listener(this, event) => unknown
options?boolean | EventListenerOptions

void

BaseElement.removeEventListener

removeEventListener(type, listener, options?): void

Defined in: packages/core/src/components/ml-scrollytelling.ts:1373

ParameterType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | EventListenerOptions

void

BaseElement.removeEventListener