jeromeetienne / tquery

extension system for three.js
http://jeromeetienne.github.io/tquery/
MIT License
652 stars 119 forks source link

make a ondestroy ? #271

Open jeromeetienne opened 11 years ago

jeromeetienne commented 11 years ago

good use case, no need for this._callback. use the js closure all the way

    var callback    = world.loop().hook(function(){
        cubeCamera.updateCubeMap( world.tRenderer(), world.tScene() );
    });

    sphere.on('destroy', function(){
        world.loop().unhook(callback)
     })
jeromeetienne commented 11 years ago

and encourage people to call destroy

jeromeetienne commented 11 years ago

same for .add/remove ?

jeromeetienne commented 11 years ago

Some localise experimentation, in various object where i dispatch 'destroy on destructor

Not inheritance infolved

Works well