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.

Node event listeners

#73

Node classes may fire events that we're interested in monitoring from outside the scene graph.

For example, SceneJS.Load now exposes its internal state and we could subscribe to transitions of that through "state-changed" events. For example:

var myLoad = new SceneJS.Load({ uri: "http://foo.com/..." });

var handler = function(node, params) {
                  alert("Node " + node.getType() + " has changed state to " + node.getState());
             };
 
myLoad.addListener("state-changed", handler,

               // Listener options
               {
                     scope: this   // Optional scope for handler call, defaults to this
               });
 
myLoad.removeListener("state-changed", handler);

Listeners may also be registered on nodes through their constructors, for example:

var collada = new SceneJS.Load({
            uri: url,
            listeners: {
                "state-changed" : {
                    fn: function(node, params) {
                        alert("State changed");
                    }
                }
            }
        });

Reported by lindsay.kay (at xeolabs) · May 13th, 2010 @ 02:56 AM

State: resolved
Milestone: V0.7.5

Activity

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

    May 16th, 2010 @ 01:33 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.