# createRuntimeLayerCatalogue

A [`LayerCatalogue`](https://docs.mapcairn.com/api/core/LayerCatalogue.md) whose definitions come from the host's own
`load` function, so they can differ for each person and change without a
deploy. The SDK never fetches them itself.

This is a function exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import { createRuntimeLayerCatalogue } from "@mapcairn/core";
 
function createRuntimeLayerCatalogue(input: RuntimeLayerCatalogueOptions): RuntimeLayerCatalogue;
```

## Parameters

- `{ load, options, onSkipped, }`
- `input` (`RuntimeLayerCatalogueOptions`)

## Returns

`RuntimeLayerCatalogue`

## Remarks

It is `loading` when built, on the server and before its first
 subscription, so a server render and the first client render agree.
 `load` is first called on the first subscription (or the first
 `refresh`), never at construction, and only once for that: a subscriber
 that leaves and another that arrives, as React's StrictMode does, make no
 second request. One request is in flight at a time, and a `refresh` made
 meanwhile gets the pending promise. There is no timer: it loads again
 only when the host calls `refresh`.

Each entry is validated alone (see `partitionDefinitions`), so a bad
 definition costs one layer. A rejected load is `failed` with `network`, a
 result that is not a list is `failed` with `invalid`, and either keeps
 the list a refresh already had.

## See also

- [`RuntimeLayerCatalogueOptions`](https://docs.mapcairn.com/api/core/RuntimeLayerCatalogueOptions.md)
- [`RuntimeLayerCatalogue`](https://docs.mapcairn.com/api/core/RuntimeLayerCatalogue.md)

Source: [packages/core/src/layers/runtimeLayerCatalogue.ts:92](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/layers/runtimeLayerCatalogue.ts#L92)
