MLScrollytelling
Defined in: packages/core/src/components/ml-scrollytelling.ts:150
The <ml-scrollytelling> custom element.
Events
Section titled “Events”Dispatched on the element as CustomEvents; listen with addEventListener.
| Event | When |
|---|---|
ml-scrollytelling:chapter | A chapter became active |
ml-scrollytelling:action | A custom chapter action ran |
ml-scrollytelling:error | The story could not be loaded or validated |
Extends
Section titled “Extends”BaseElement
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MLScrollytelling():
MLScrollytelling
Defined in: packages/core/src/components/ml-scrollytelling.ts:196
Returns
Section titled “Returns”MLScrollytelling
Overrides
Section titled “Overrides”BaseElement.constructor
Accessors
Section titled “Accessors”activeChapterId
Section titled “activeChapterId”Get Signature
Section titled “Get Signature”get activeChapterId():
string|null
Defined in: packages/core/src/components/ml-scrollytelling.ts:320
The active chapter’s id, or null.
Returns
Section titled “Returns”string | null
Get Signature
Section titled “Get Signature”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>.
Returns
Section titled “Returns”string | null
Set Signature
Section titled “Set Signature”set base(
value):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:285
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string | null |
Returns
Section titled “Returns”void
config
Section titled “config”Get Signature
Section titled “Get Signature”get config(): {[
key:string]:any; } |null
Defined in: packages/core/src/components/ml-scrollytelling.ts:311
Alias of story, mirroring <ml-map>’s config.
Returns
Section titled “Returns”{[key: string]: any; } | null
Set Signature
Section titled “Set Signature”set config(
value):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:315
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string | {[key: string]: any; } | null |
Returns
Section titled “Returns”void
mapElement
Section titled “mapElement”Get Signature
Section titled “Get Signature”get mapElement():
MLMap|null
Defined in: packages/core/src/components/ml-scrollytelling.ts:325
The story’s <ml-map>, once the story has rendered.
Returns
Section titled “Returns”MLMap | null
Get Signature
Section titled “Get Signature”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).
Returns
Section titled “Returns”{[key: string]: any; } | null
Set Signature
Section titled “Set Signature”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string | {[key: string]: any; } | null |
Returns
Section titled “Returns”void
observedAttributes
Section titled “observedAttributes”Get Signature
Section titled “Get Signature”get
staticobservedAttributes():string[]
Defined in: packages/core/src/components/ml-scrollytelling.ts:151
Returns
Section titled “Returns”string[]
Methods
Section titled “Methods”addEventListener()
Section titled “addEventListener()”Call Signature
Section titled “Call Signature”addEventListener<
K>(type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1348
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof MLScrollytellingEventMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | K |
listener | (this, event) => unknown |
options? | boolean | AddEventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.addEventListener
Call Signature
Section titled “Call Signature”addEventListener<
K>(type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1353
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof HTMLElementEventMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | K |
listener | (this, event) => unknown |
options? | boolean | AddEventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.addEventListener
Call Signature
Section titled “Call Signature”addEventListener(
type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1358
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | string |
listener | EventListenerOrEventListenerObject |
options? | boolean | AddEventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.addEventListener
attributeChangedCallback()
Section titled “attributeChangedCallback()”attributeChangedCallback(
name,oldValue,newValue):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:423
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name | string |
oldValue | string | null |
newValue | string | null |
Returns
Section titled “Returns”void
connectedCallback()
Section titled “connectedCallback()”connectedCallback():
void
Defined in: packages/core/src/components/ml-scrollytelling.ts:399
Returns
Section titled “Returns”void
disconnectedCallback()
Section titled “disconnectedCallback()”disconnectedCallback():
void
Defined in: packages/core/src/components/ml-scrollytelling.ts:417
Returns
Section titled “Returns”void
getGrid()
Section titled “getGrid()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”GridField | undefined
getMap()
Section titled “getMap()”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.
Returns
Section titled “Returns”maplibregl.Map | null
goToChapter()
Section titled “goToChapter()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
chapterId | string |
Returns
Section titled “Returns”void
gridReady()
Section titled “gridReady()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”Promise<GridField>
hasGrid()
Section titled “hasGrid()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
sourceId | string |
Returns
Section titled “Returns”boolean
mapReady()
Section titled “mapReady()”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.
Returns
Section titled “Returns”Promise<maplibregl.Map>
removeEventListener()
Section titled “removeEventListener()”Call Signature
Section titled “Call Signature”removeEventListener<
K>(type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1363
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof MLScrollytellingEventMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | K |
listener | (this, event) => unknown |
options? | boolean | EventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.removeEventListener
Call Signature
Section titled “Call Signature”removeEventListener<
K>(type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1368
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends keyof HTMLElementEventMap |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | K |
listener | (this, event) => unknown |
options? | boolean | EventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.removeEventListener
Call Signature
Section titled “Call Signature”removeEventListener(
type,listener,options?):void
Defined in: packages/core/src/components/ml-scrollytelling.ts:1373
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type | string |
listener | EventListenerOrEventListenerObject |
options? | boolean | EventListenerOptions |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseElement.removeEventListener