Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Tidy up node constructors

#155

The default constructor technique is getting dirty, forcing us into inefficiencies, such as with ID registration:

SceneJS.Node = function() {
    this._nodeType = "node";
    this._NODEINFO = null;  // Big and bold, to stand out in debugger object graph inspectors
    this._sid = null;
    this._children = [];
    this._fixedParams = true;
    this._parent = null;
    this._listeners = {};
    this._numListeners = 0; // Useful for quick check whether node observes any events
    this._addedEvents = []; // Events added with #addEvent
    this._eventsOut = []; // FIFO queue for events fired from this node with #fireEvent, flushed after each render

    /* Used by many node types to track the level at which they can
     * memoise internal state. When rendered, a node increments
     * this each time it discovers that it can cache more state, so that
     * it knows not to recompute that state when next rendered.
     * Since internal state is usually dependent on the states of higher
     * nodes, this is reset whenever the node is attached to a new
     * parent.
     *
     * private
     */
    this._memoLevel = 0;

    /* Deregister default ID    
     */
    if (this._id) {
        SceneJS._nodeIDMap[this._id] = null;
    }
    
    SceneJS.Node._ArgParser.parseArgs(arguments, this);

    /* Register again by whatever ID we now have
     */
    if (!this._id) {
        this._id = SceneJS._createKeyForMap(SceneJS._nodeIDMap, "n");
    }
    SceneJS._nodeIDMap[this._id] = this;
};

Reported by lindsay.kay (at xeolabs) · August 18th, 2010 @ 07:31 PM

State: resolved
Milestone: none

Activity

  1. lindsay.kay (at xeolabs)
    lindsay.kay (at xeolabs)
    • State changed from open to resolved

    August 31st, 2010 @ 09:50 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.