Processing.js - Is there a destructor?

This might be a naive question, but is there a destructor in Processing.js? I know that regular Processing is Java-based so there isn't a destructor, but I'm not sure if Processing.js runs the same way.

Just so it's here, here's the class I want to build a destructor for, if needed:

// Obstacle Class
class Obstacle {
    float r,g,b;
    float x, y, w, h;
    float speed;

    Obstacle(float x_pos, float y_pos, float width, float height, float sp) {
        // Initialize Color
        r = random(255);
        g = random(255);
        b = random(255);

        // Initial Size
        w = width;
        h = height;

        // Initial Position
        x = x_pos;
        y = y_pos;

        // Initialize Speed
        speed = sp;
    }

    void update() {
        y += speed;
    }

    void draw() {
        fill(r,g,b);
        rect(x,y,w,h);
    }
}

Answers


Processing.js doesn't control memory allocation or cleanup, it's all left to the JavaScript engine. Once you remove all references to an object, the JS engine will queue the object for garbage collection, and will actually free the memory whenever it needs to, afterwards.


Need Your Help

Install SSL certificate on IIS which has been removed

web-services security iis ssl ssl-certificate

Recently one SSL certificate has been removed from IIS but still available in Trusted Root when I open it via MMC. The cert seems dose not have a private key so when I export it again from mmc it c...