Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] What's the proper way to clean up nodes? #489

Open
trusktr opened this issue Sep 2, 2015 · 2 comments
Open

[question] What's the proper way to clean up nodes? #489

trusktr opened this issue Sep 2, 2015 · 2 comments

Comments

@trusktr
Copy link
Contributor

trusktr commented Sep 2, 2015

Can you give a short example of the proper way to make sure nodes are cleaned up when removed from a scene graph?

@CompSciFutures
Copy link

@trusktr just leaving this here for the next victim of this problem...

var Dismount = function(node) {
    var aNodes = [];
    if ( !(node instanceof famous.core.Node) )
        throw "node not a Famous#Node";

    var f = function(current) {
        aNodes.push(current);
        var aChildren = current.getChildren();
        for ( var i in aChildren )
            f(aChildren[i]);
    };

    f(node);

    while ( aNodes.length ) {
        var x = aNodes.pop();
        if ( x.isMounted())
            x.dismount();
    }
}

Haven't had any problems with the above recently.

@trusktr
Copy link
Contributor Author

trusktr commented Sep 27, 2015

For reference, the problem is here: #487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@trusktr @CompSciFutures and others