Created
October 11, 2009 00:30
-
-
Save xeolabs/207287 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SceneJs.MyNewNode = function(cfg) { | |
cfg = cfg || {}; | |
/** Called when pre-visited during scene traversal | |
*/ | |
this.preVisit = function() { | |
var backend = SceneJs.Backend.getNodeBackend(this.getType()); | |
if (backend) { | |
var someData = {}; | |
backend.doSomethingToCanvas(someData); | |
} | |
}; | |
/** Called when post-visited during scene traversal | |
*/ | |
this.postVisit = function() { | |
var backend = SceneJs.Backend.getNodeBackend(this.getType()); | |
if (backend) { | |
var someMoreData = {}; | |
backend.doSomethingElseToCanvas(someMoreData); | |
} | |
}; | |
/** Chain a call from this constructor to constructor of Node superclass | |
*/ | |
SceneJs.Node.superclass.constructor.call(this, SceneJs.apply(cfg, { | |
getType: function() { | |
return 'my-node-type'; | |
} | |
})); | |
}; | |
/* Extend the Node class with our new MyNewNode class | |
*/ | |
SceneJs.extend(SceneJs.MyNewNode, SceneJs.Node, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment