Function
Static Public Summary | ||
public |
Returns all child elements of parent (fall-back to document if not given) matching the given selector as an array. |
|
public |
Returns the first child element of parent (fall-back to document if not given) matching the given selector. |
|
public |
EventMixin(base: class): class Wraps Leaflet's L.Evented for use within class expressions. |
|
public |
Turns an HTML string into an array of DOM elements. |
|
public |
Turns an HTML string into a DOM element. |
|
public |
Adds the given nodes as children to the given parent node. |
|
public |
Darken a given hex color by a given ratio. |
|
public |
loadClusterLayer(geojsonPath: string): L.GeoJSON Loads the given GeoJSON URL and returns a Leaflet GeoJSON layer that contains a child layer for each cluster. |
|
public |
loadCountryLayer(geojsonPath: string): L.GeoJSON Loads the given GeoJSON URL and returns a Leaflet GeoJSON layer that contains a child layer for each country. |
Static Public
public $(selector: string, parent: string | Element): Array<Element> source
import {$} from './util/dom.js'
Returns all child elements of parent (fall-back to document if not given) matching the given selector as an array.
Example:
let items = $('.item', '#list')
public $$(selector: string, parent: string | Element): Element source
import {$$} from './util/dom.js'
Returns the first child element of parent (fall-back to document if not given) matching the given selector.
Example:
let element = $$('.myclass')
public EventMixin(base: class): class source
import EventMixin from './util/EventMixin.js'
Wraps Leaflet's L.Evented for use within class expressions.
Params:
Name | Type | Attribute | Description |
base | class | The base class. |
public HTML(html: string): Array<Element> source
import {HTML} from './util/dom.js'
Turns an HTML string into an array of DOM elements.
Params:
Name | Type | Attribute | Description |
html | string | The HTML string out of which to create the single DOM element. |
Example:
let html = '<li>foo</li><li>bar</li>'
let elements = HTML(html)
add(elements, document.body)
public HTMLone(html: string): Element source
import {HTMLone} from './util/dom.js'
Turns an HTML string into a DOM element. The HTML markup must have a single root node, whitespace is ignored.
Params:
Name | Type | Attribute | Description |
html | string | The HTML string out of which to create the single DOM element. |
Example:
let html = '<li>text</li>'
let element = HTMLone(s)
document.body.appendChild(element)
public add(nodes: string | Node | Array<Node>, el: Node) source
import {add} from './util/dom.js'
Adds the given nodes as children to the given parent node.
Example:
let elements = HTML('<li>foo</li><li>bar</li>')
add(elements, document.body)
public darken(hex: string, ratio: number): string source
import {darken} from './layers/util.js'
Darken a given hex color by a given ratio. If negative, lighten up.
Example:
let darker = darken('#ADD8E6', 0.2) // darken by 20%
public loadClusterLayer(geojsonPath: string): L.GeoJSON source
import {loadClusterLayer} from './layers/ClusterLayer.js'
Loads the given GeoJSON URL and returns a Leaflet GeoJSON layer that contains a child layer for each cluster.
Each cluster layer has an associated cluster label layer which is not part of the returned GeoJSON layer. Once the GeoJSON layer is added to a map, then the label layers are added to the same map as well, and removed again once the GeoJSON layer is removed. It is currently not possible to easily access the label layers programmatically after this function returns.
Params:
Name | Type | Attribute | Description |
geojsonPath | string | The GeoJSON URL to load. |
public loadCountryLayer(geojsonPath: string): L.GeoJSON source
import {loadCountryLayer} from './layers/CountryLayer.js'
Loads the given GeoJSON URL and returns a Leaflet GeoJSON layer that contains a child layer for each country.
Each country layer has an associated country label layer which is not part of the returned GeoJSON layer. Once the GeoJSON layer is added to a map, then the label layers are added to the same map as well, and removed again once the GeoJSON layer is removed. It is currently not possible to easily access the label layers programmatically after this function returns.
The returned GeoJSON layer listens for the following custom events:
fill
/nofill
- when received, enables/disables polygon fillingshowmarkers
/hidemarkers
- when received, adds/removes all country labels
Params:
Name | Type | Attribute | Description |
geojsonPath | string | The GeoJSON URL to load. |