destroy(asyncId)
- asyncId<number>
asyncId 对应的资源销毁后调用。
它也从嵌入器 API emitDestroy() 异步调用。
有些资源依赖垃圾回收来清理,所以如果引用传给 init 的 resource 对象,可能永远不会调用 destroy,从而导致应用程序内存泄漏。
如果资源不依赖垃圾回收,则这不是问题。
- asyncId<number>
Called after the resource corresponding to asyncId is destroyed. It is also
called asynchronously from the embedder API emitDestroy().
Some resources depend on garbage collection for cleanup, so if a reference is
made to the resource object passed to init it is possible that destroy
will never be called, causing a memory leak in the application. If the resource
does not depend on garbage collection, then this will not be an issue.