Skip to content

KBE3D / KBCore / Cesium / destroyObject

函数: destroyObject()

destroyObject(object: any, message?: string): void

Destroys an object. Each of the object's functions, including functions in its prototype, is replaced with a function that throws a DeveloperError, except for the object's <code>isDestroyed</code> function, which is set to a function that returns <code>true</code>. The object's properties are removed with <code>delete</code>. <br /><br /> This function is used by objects that hold native resources, e.g., WebGL resources, which need to be explicitly released. Client code calls an object's <code>destroy</code> function, which then releases the native resource and calls <code>destroyObject</code> to put itself in a destroyed state.

参数

object

any

The object to destroy.

message?

string

The message to include in the exception that is thrown if a destroyed object's function is called.

返回

void

示例

ts
// How a texture would destroy itself.
this.destroy = function () {
    _gl.deleteTexture(_texture);
    return Cesium.destroyObject(this);
};

KBE3D @3.0.0 Copyright © 2024-present KBE3D