defineMapElement
Registers the <mapcairn-map> element, or one under another name. Asking
twice is safe: a name that is taken is left as it is. A page that loads
browser-element.js needs no call, because that file registers the element
itself.
This is a function exported by @mapcairn/sdk/browser, checked against version 0.2.0.
Signature
import { defineMapElement } from "@mapcairn/sdk/browser";
function defineMapElement(name?: string): MapCairnMapElementClass | undefined;
Parameters
name?(string): The tag name, with a hyphen in it."mapcairn-map"when left out. Another name needsdisplay: blockin the page's CSS: the stylesheet gives that tomapcairn-maponly.
Returns
MapCairnMapElementClass | undefined: The element's class, or undefined where there is no browser.
Throws
- MountMapError when
namecannot name an element.
Examples
defineMapElement();
document.body.append(document.createElement("mapcairn-map"));
See also
Source: packages/sdk/src/browser/element/defineMapElement.ts:24