title: OpenLayers: Utility getSource().on to wait one second to load or reload TileLayer
body: <p>I am using OpenLayers5.</p>
  <p>I'm working with Tile Layers in my project, but I need that when I move to the map, the layer will load with one second delay to no call many times to server.</p>
  <p>My code is</p>
  <pre><code>app.controller(&quot;MainController&quot;, [
    function () {
      const map = new ol.Map({
        target: &quot;map&quot;,
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM(),
          }),
          new ol.layer.Tile({
            id: &quot;positions&quot;,
            visible: true,
            source: new ol.source.TileWMS({
              refresh: {
                force: true,
              },
              visible: true,
              projections: [&quot;EPSG:4326&quot;],
              url: &quot;http://localhost:9000/getMap&quot;,
            }),
          }),
        ],
        view: new ol.View({
          center: [0, 0],
          zoom: 0,
        }),
      });
    },
  ]);
  </code></pre>
  <p>I saw in OpenLayers the following three functions:</p>
  <pre><code>getSource().on(&quot;tileloadstart&quot;, function () {
     // While loading the layer
     console.log(&quot;tileloadstart&quot;);
  });
  
  getSource().on(&quot;tileloadend&quot;, function () {
     // At the end of the layer loading
     console.log(&quot;tileloadend&quot;);
  });
        
  getSource().on(&quot;tileloaderror&quot;, function () {
     //If throw error while loading
     console.log(&quot;tileloaderror&quot;);
  });
  </code></pre>
  <p>I need to wait a second while I move the map or zoom so as not to overload the server calls</p>