title: Leaflet make function synchronous
body: <p>I tried to call the setMarker() function in another function. But the markers ain´t set. I don´t know why, but maybe because the setMarker() function is async because of the Promise.</p>
  <h2>getCities()</h2>
  <pre><code>getCities(rawData) {
      for (const index in rawData['data']) {
          if (rawData.meta.c0Name == 'city') {
              const city: string = rawData['data'][index]['c0'];
  
              if (city != undefined) {
                  this.setMarker(city);
              }
          }
      }
  </code></pre>
  <h2>setMarker()</h2>
  <pre><code> setMarker(location: string) {
      const provider = new OpenStreetMapProvider();
  
      const query_promise = provider.search({
          query: location,
      });
  
      query_promise.then(
          (value) =&gt; {
              // Success!
              const x_coor = value[0].x;
              const y_coor = value[0].y;
              const label = value[0].label;
              this.citiesLayer = [
                  L.marker([y_coor, x_coor])
                      .bindPopup('&lt;b&gt;Found location&lt;/b&gt;&lt;br&gt;' + label)
                      .addTo(this.citiesLayerGroup),
              ];
          },
          (reason) =&gt; {
              console.log(reason); // Error!
          }
      );
  }
  </code></pre>
  <p>The rawData I get from my webDataRocksComponent</p>
  <pre><code>    getDataForMap() {
      this.child.webDataRocks.getData(
          {},
          (rawData) =&gt; {
              this.mapComponent.getCities(rawData);
          },
          (rawData) =&gt; {
              this.mapComponent.getCities(rawData);
          }
      );
  }
  </code></pre>