Request

new Cesium.Request(options)

存储用于发出请求的信息。通常,这不需要直接构造。
Name Type Description
options object optional 对象,具有以下属性:
Name Type Default Description
url string optional 要请求的 URL。
requestFunction Request.RequestCallback optional 发出实际数据请求的函数。
cancelFunction Request.CancelCallback optional 取消请求时调用的函数。
priorityFunction Request.PriorityCallback optional 为更新请求的优先级而调用的函数,每帧发生一次。
priority number 0.0 optional 请求的初始优先级。
throttle boolean false optional 是否限制请求并确定其优先级。如果为 false,则会立即发送请求。如果为 true,则请求将被限制并根据优先级发送。
throttleByServer boolean false optional 是否按服务器限制请求。
type RequestType RequestType.OTHER optional 请求的类型。
serverKey string optional 用于标识请求将要发送到的服务器的键。

Members

取消请求时调用的函数。
优先级是无单位的值,其中较低的值表示较高的优先级。 对于基于世界的对象,这通常是与摄像机的距离。 没有优先级函数的请求默认为优先级 0。 如果定义了 priorityFunction,则使用该调用的结果在每一帧中更新此值。
Default Value: 0.0
为更新请求的优先级而调用的函数,每帧发生一次。
发出实际数据请求的函数。
请求的当前状态。

readonly throttle : boolean

是否限制请求并确定请求的优先级。如果为 false,则会立即发送请求。如果为 true,则 请求将受到限制,并根据优先级发送。
Default Value: false

readonly throttleByServer : boolean

是否按服务器限制请求。浏览器通常支持大约 6-8 个并行连接 对于 HTTP/1 服务器,对于 HTTP/2 服务器,连接数量不受限制。设置此值 对于通过 HTTP/1 服务器的请求,最好设置为 true
Default Value: false
Type of request.
Default Value: RequestType.OTHER
要请求的 URL。

Methods

复制Request实例。
Name Type Description
result Request optional 要在其上存储结果的对象。
Returns:
修改后的结果参数或者新的 Resource 实例(如果未提供)。

Type Definitions

Cesium.Request.CancelCallback()

在 the request is cancelled.

Cesium.Request.PriorityCallback()number

为更新请求的优先级而调用的函数,每帧发生一次。
Returns:
更新的优先级值。

Cesium.Request.RequestCallback()Promise.<void>

发出实际数据请求的函数。
Returns:
请求数据的 Promise。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.