Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="inheritance.js"></script>
- <script type="text/javascript">
- var test = {};
- test.Person = Class.extend({
- init: function() {
- },
- });
- test.Ninja = test.Person.extend({
- init: function() {
- this._super();
- }
- });
- function debug_mode(namespace) {
- for (var i in namespace) {
- if (typeof namespace[i] === 'object') {
- //handle namespace
- debug_mode(namespace[i]);
- } else if (typeof namespace[i] === 'function') {
- //handle class constructor
- if (i.match(/^[A-Z]/)) {
- debug_mode(namespace[i].prototype);
- return;
- }
- console.log('function name:' + i);
- //rewrite real function
- var func = namespace[i];
- namespace[i] = function() {
- console.log('called:' + i);
- func();
- };
- }
- }
- }
- debug_mode(test);
- new test.Person();
- </script>
- </head>
- <body></body>
- </html>
Add Comment
Please, Sign In to add comment