title: Leaflet: async alternative to pointToLayer?
body: <p>Right now, I have something like:</p>
  
  <pre class="lang-js prettyprint-override"><code>this.Layer = Leaflet.geoJSON(geoJson, {
      pointToLayer: function (feature, latlng) {
          return Leaflet.marker(latlng, {
              icon: arrowIcon,
              rotationAngle: (&lt;MyFeatureType&gt;feature.properties).DirectionTo,
              title: (&lt;MyFeatureType&gt;feature.properties).Speed.toString()
              });
          }
     }
  </code></pre>
  
  <p>This works. For each <code>Point</code> feature in the GeoJSON, my function gets called, and I get to create a custom marker.</p>
  
  <p>However, I'd like to change it such as that the <code>pointToLayer</code> function is async; something like:</p>
  
  <pre class="lang-js prettyprint-override"><code>this.Layer = Leaflet.geoJSON(geoJson, {
      pointToLayer: async function (feature, latlng) {
          var data = await retrieveSomeMetadataForFeature(feature);
  
          return Leaflet.marker(latlng, {
              icon: data.Icon,
              rotationAngle: (&lt;MyFeatureType&gt;feature.properties).DirectionTo,
              title: (&lt;MyFeatureType&gt;feature.properties).Speed.toString()
              });
          }
     }
  </code></pre>
  
  <p>Unfortunately, Leaflet doesn't seem to support handling a Promise as a return type.</p>
  
  <p><em>Nor</em>, it seems, can I simply return <code>null</code> and add the marker manually, e.g.:</p>
  
  <pre class="lang-js prettyprint-override"><code>this.Layer = Leaflet.geoJSON(geoJson, {
      pointToLayer: async function (feature, latlng) {
          var data = await retrieveSomeMetadataForFeature(feature);
  
          var marker = Leaflet.marker(latlng, {
              icon: data.Icon,
              rotationAngle: (&lt;MyFeatureType&gt;feature.properties).DirectionTo,
              title: (&lt;MyFeatureType&gt;feature.properties).Speed.toString()
              });
          }
  
          // manually add marker to layer here
  
          return null; // simply tell Leaflet that this has been handled
     }
  </code></pre>
  
  <p>While the marker appears, Leaflet never calls into <code>pointToLayer</code> a second time.</p>
  
  <p>Questions:</p>
  
  <ul>
  <li>is there a way to call <code>pointToLayer</code> and return the result asynchronously to Leaflet? (Presumably, all that would accomplish is add the marker to the correct layer group?)</li>
  <li>failing that, can I somehow tell Leaflet not to create the marker at all, and that the "event" of sorts has been handled?</li>
  <li>or, is there an alternative to <code>pointToLayer</code> that overrides marker creation?</li>
  </ul>