Skip to content

StyleLayer

Defined in: style/style_layer.ts:86

A base class for style layers

Extends

Methods

getLayoutAffectingGlobalStateRefs()

getLayoutAffectingGlobalStateRefs(): Set<string>

Defined in: style/style_layer.ts:192

Get list of global state references that are used within layout or filter properties. This is used to determine if layer source need to be reloaded when global state property changes.

Returns

Set<string>


getPaintAffectingGlobalStateRefs()

getPaintAffectingGlobalStateRefs(): Map<string, PaintPropertyEntry[]>

Defined in: style/style_layer.ts:221

Get list of global state references that are used within paint properties. This is used to determine if layer needs to be repainted when global state property changes.

Returns

Map<string, PaintPropertyEntry[]>


getVisibilityAffectingGlobalStateRefs()

getVisibilityAffectingGlobalStateRefs(): Set<string>

Defined in: style/style_layer.ts:243

Get list of global state references that are used within visibility expression. This is used to determine if layer visibility needs to be updated when global state property changes.

Returns

Set<string>


listens()

listens(type: string): boolean

Defined in: util/evented.ts:180

Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.

Parameters

Parameter Type Description
type string The event type

Returns

boolean

true if there is at least one registered listener for specified event type, false otherwise

Inherited from

Evented.listens


off()

off<T>(type: T, listener: (event: any) => void): this

Defined in: util/evented.ts:95

Removes a previously registered event listener.

Type Parameters

Type Parameter
T extends string

Parameters

Parameter Type Description
type T The event type to remove listeners for.
listener (event: any) => void The listener function to remove.

Returns

this

Inherited from

Evented.off


on()

on<T>(type: T, listener: (event: any) => void): Subscription

Defined in: util/evented.ts:78

Adds a listener to a specified event type.

Type Parameters

Type Parameter
T extends string

Parameters

Parameter Type Description
type T The event type to add a listen for.
listener (event: any) => void The function to be called when the event is fired. The listener function is called with the data object passed to fire, extended with target and type properties.

Returns

Subscription

Inherited from

Evented.on


once()

Call Signature

once<T>(type: T): Promise<any>

Defined in: util/evented.ts:110

Adds a listener that will be called only once to a specified event type.

The listener will be called first time the event fires after the listener is registered.

Type Parameters
Type Parameter
T extends string
Parameters
Parameter Type Description
type T The event type to listen for.
Returns

Promise<any>

a promise that resolves with the event

Inherited from

Evented.once

Call Signature

once<T>(type: T, listener: (event: any) => void): this

Defined in: util/evented.ts:120

Adds a listener that will be called only once to a specified event type.

The listener will be called first time the event fires after the listener is registered.

Type Parameters
Type Parameter
T extends string
Parameters
Parameter Type Description
type T The event type to listen for.
listener (event: any) => void The function to be called when the event is fired the first time.
Returns

this

this when a listener is provided

Inherited from

Evented.once


setEventedParent()

setEventedParent(parent?: Evented<Record<string, any>>, data?: any): this

Defined in: util/evented.ts:191

Bubble all events fired by this instance of Evented to this parent instance of Evented.

Parameters

Parameter Type
parent? Evented<Record<string, any>>
data? any

Returns

this

Inherited from

Evented.setEventedParent