<mosaica-store>¶
A wrapper that shares one store between the elements inside it.
Use <mosaica-store> when you lay out the elements yourself, so that the map, the filter panel
and the cards all show the same view and filters. The elements inside it find its store through
context, which means you do not pass the store to each one. Put each map of a different view in
its own wrapper. <mosaica-explorer> provides its own store, so it needs no wrapper.
The wrapper uses the store in its store property. When that is not set, it builds one from
viewer-url and token or authorise.
import '@mosaicajs/components/store';
Attributes¶
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
viewer-url |
viewerUrl |
string |
'' |
The base URL of the Mosaica viewer server, for the store the element builds: a full URL such as https://maps.example.org, or a path such as /mosaica. Unset, the page's own origin. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
token |
token |
string |
'' |
A viewer token for the store the element builds. Without token or authorise, only an open server (serve.open) answers. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
artifacts-per-tile |
artifactsPerTile |
number | null |
null |
The most artifacts one level of a layer shows per map tile, for the store the element builds. Unset, 50, or the server's selection.max_artifacts_per_tile if lower. A value above that maximum is refused. Read only by the map, the explorer and <mosaica-store>. Changing it builds a new store. |
Properties¶
Set as JavaScript properties; they have no attribute.
| Property | Type | Default | Description |
|---|---|---|---|
store |
Store | null |
null |
The store to use, ahead of one from context or one the element would build. The element never disposes it. |
authorise |
TokenSupplier | null |
null |
A function that returns a viewer token, used instead of token and called again before the token expires. A different function builds a new store, so keep it stable across renders. Set it together with viewer-url: a store built from viewer-url alone first sends a request with no token, and is replaced when authorise arrives. |
activeStore |
Store | null |
read-only | The store this element is using, or null if it has none. |
source |
StoreSource |
read-only | Where activeStore came from. |
Methods¶
| Method | Returns | Description |
|---|---|---|
dispose() |
void |
Dispose of the store this element built. Removing the element from the page does not, so call this when you are done with the element. A store you passed in is left to you. |
Slots¶
| Slot | Description |
|---|---|
| (default) | The elements that use the store. |