Skip to content

Latest commit

 

History

History
60 lines (36 loc) · 1.08 KB

README_zh_cn.md

File metadata and controls

60 lines (36 loc) · 1.08 KB

catfish

语言: English | 中文简体

catfish 是什么 ?

threejs垃圾回收器,释放内存。

任何实例引用,都会导致释放内存失败,例如:浏览器插件、console。

特性

  • 轻量易用

  • 深度清理

  • 支持typescript

安装

npm i @dreamoment/catfish

示例

import Catfish from '@dreamoment/catfish'

// Do not have redundant references to instances, or you will not be able to clean up successfully.
// console.log(object3D)

Catfish.dispose(object3D)

// If the variable is global, you must explicitly set the variable to null
object3D = null

// If you want to completely destroy the 3D application
// Catfish.exit(renderer)

API

static dispose

释放threejs实例内存。

Catfish.dispose(object: THREE.Object3D | THREE.BufferGeometry | THREE.Material | THREE.Texture): void

static exit

销毁threejs应用。在调用exit之前,应该始终先调用dispose

Catfish.exit(renderer: THREE.WebGLRenderer): void