throttleRequestByServer(url, requestFunction)Promise.<Object>|undefined

Because browsers throttle the number of parallel requests allowed to each server, this function tracks the number of active requests in progress to each server, and returns undefined immediately if the request would exceed the maximum, allowing the caller to retry later, instead of queueing indefinitely under the browser's control.
Name Type Description
url String The URL to request.
requestFunction throttleRequestByServer~RequestFunction The actual function that makes the request.
Either undefined, meaning the request would exceed the maximum number of parallel requests, or a Promise for the requested data.
// throttle requests for an image
var url = '';
function requestFunction(url) {
  // in this simple example, loadImage could be used directly as requestFunction.
  return SuperMap3D.loadImage(url);
var promise = SuperMap3D.throttleRequestByServer(url, requestFunction);
if (!SuperMap3D.defined(promise)) {
  // too many active requests in progress, try again later.
} else {
  promise.then(function(image) {
    // handle loaded image


staticSuperMap3D.throttleRequestByServer.maximumRequestsPerServer : Number

Specifies the maximum number of requests that can be simultaneously open to a single server. If this value is higher than the number of requests per server actually allowed by the web browser, SuperMap3D's ability to prioritize requests will be adversely affected.
Default Value: 6

Type Definitions


A function that will make a request if there are available slots to the server.
Name Type Description
url String The url to request.
A promise for the requested data.