Node's listeners should execute on node scope - remove self param from func signature
Reported by lindsay.kay (at xeolabs) | August 7th, 2010 @ 03:02 AM | in V0.7.7
Take "picked" listeners for example:
SceneJS.node({
sid: "alpha",
listeners: {
"picked":{
fn: function(self, params) {
alert(self.getSID() + " handling 'picked' event from " + params.uri);
}
}
}
},
We dont need the self param - remove it to keep things terse, just fire the listener on the node scope:
SceneJS.node({
sid: "alpha",
listeners: {
"picked":{
fn: function(params) {
alert(this.getSID() + " handling 'picked' event from " + params.uri);
}
}
}
},
Comments and changes to this ticket
-
lindsay.kay (at xeolabs) August 7th, 2010 @ 03:06 AM
Originally I thought it might be nice to control the scope of the listener the way ExtJS does, but there are other ways to do that, eg. using delegate functions, and the main idea of SceneJS is simplicity first.
-
lindsay.kay (at xeolabs) August 7th, 2010 @ 03:37 AM
- State changed from open to resolved
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.