UNPKG

686 BHTMLView Raw
1---
2layout: example.html
3title: Lazy Source
4shortdesc: Example of setting a layer source after construction.
5docs: >
6 <p>Typically, the source for a layer is provided to the layer constructor.
7 If you need to set a layer source after construction, this can be
8 done with the <code>layer.setSource()</code> method.</p>
9 <p>The layer in the map above is constructed with no source. Use the
10 links below to set/unset the layer source. A layer is not rendered
11 until its source is set.</p>
12tags: "source"
13---
14<div id="map" class="map"></div>
15<button id="set-source" class="code">layer.setSource(source)</button>
16<button id="unset-source" class="code">layer.setSource(null)</button>