| 17 | | dojo.debug("> dojo.declare('my.classes.foo'..."); |
| 18 | | dojo.declare('my.classes.foo', null, |
| 19 | | function(arg) { |
| 20 | | dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| 21 | | this.id = 'foo'; |
| 22 | | }, |
| 23 | | { |
| 24 | | getInstanceId: function(extra) { |
| 25 | | var ancestorId = my.classes.foo.superclass.getInstanceId.apply(this, arguments); |
| 26 | | return "a " + this.id + (ancestorId ? " is " + ancestorId : ''); |
| | 17 | dojo.addOnLoad(function(){ |
| | 18 | dojo.debug("> dojo.declare('my.classes.foo'..."); |
| | 19 | dojo.declare('my.classes.foo', null, |
| | 20 | function(arg) { |
| | 21 | dojo.debug('foo: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| | 22 | this.id = 'foo'; |
| 28 | | getId: function() { |
| 29 | | return "I am a foo"; |
| | 24 | { |
| | 25 | getInstanceId: function(extra) { |
| | 26 | var ancestorId = my.classes.foo.superclass.getInstanceId.apply(this, arguments); |
| | 27 | return "a " + this.id + (ancestorId ? " is " + ancestorId : ''); |
| | 28 | }, |
| | 29 | getId: function() { |
| | 30 | return "I am a foo"; |
| | 31 | }, |
| | 32 | method: function() { |
| | 33 | return "A method in foo"; |
| | 34 | } |
| | 35 | }); |
| | 36 | |
| | 37 | dojo.debug("> dojo.declare('my.classes.bar', my.classes.foo, ..."); |
| | 38 | dojo.declare('my.classes.bar', my.classes.foo, |
| | 39 | function(arg) { |
| | 40 | dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| | 41 | this.id = 'bar'; |
| 31 | | method: function() { |
| 32 | | return "A method in foo"; |
| 33 | | } |
| 34 | | }); |
| 35 | | |
| 36 | | dojo.debug("> dojo.declare('my.classes.bar', my.classes.foo, ..."); |
| 37 | | dojo.declare('my.classes.bar', my.classes.foo, |
| 38 | | function(arg) { |
| 39 | | dojo.debug('bar: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| 40 | | this.id = 'bar'; |
| 41 | | }, |
| 42 | | { |
| 43 | | getId: function(extra) { |
| 44 | | return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); |
| 45 | | } |
| 46 | | }); |
| 47 | | dojo.debug(''); |
| 48 | | |
| 49 | | dojo.debug('> b = new my.classes.bar()'); |
| 50 | | b = new my.classes.bar(); |
| 51 | | dojo.debug(''); |
| 52 | | |
| 53 | | dojo.debug("> dojo.declare('my.classes.zot', my.classes.bar, ..."); |
| 54 | | dojo.declare('my.classes.zot', my.classes.bar, |
| 55 | | function(arg) { |
| 56 | | dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| 57 | | this.id = 'zot'; |
| 58 | | }, |
| 59 | | { |
| 60 | | getId: function(extra) { |
| 61 | | return "I am a zot and " + my.classes.zot.superclass.getId.apply(this, arguments); |
| 62 | | } |
| 63 | | }); |
| 64 | | dojo.debug(''); |
| 65 | | |
| 66 | | dojo.debug('> f = new my.classes.foo()'); |
| 67 | | f = new my.classes.foo(); |
| 68 | | dojo.debug(''); |
| 69 | | |
| 70 | | dojo.debug('> z = new my.classes.zot("with an argument")'); |
| 71 | | z = new my.classes.zot("with an argument"); |
| 72 | | dojo.debug(''); |
| 73 | | |
| 74 | | dojo.debug('> f.getId()'); |
| 75 | | dojo.debug(f.getId()); |
| 76 | | dojo.debug(''); |
| 77 | | |
| 78 | | dojo.debug('> b.getId()'); |
| 79 | | dojo.debug(b.getId()); |
| 80 | | dojo.debug(''); |
| 81 | | |
| 82 | | dojo.debug('> z.getId()'); |
| 83 | | dojo.debug(z.getId()); |
| 84 | | dojo.debug(''); |
| 85 | | |
| | 43 | { |
| | 44 | getId: function(extra) { |
| | 45 | return "I am a bar and " + my.classes.bar.superclass.getId.apply(this, arguments); |
| | 46 | } |
| | 47 | }); |
| | 48 | dojo.debug(''); |
| | 49 | |
| | 50 | dojo.debug('> b = new my.classes.bar()'); |
| | 51 | b = new my.classes.bar(); |
| | 52 | dojo.debug(''); |
| | 53 | |
| | 54 | dojo.debug("> dojo.declare('my.classes.zot', my.classes.bar, ..."); |
| | 55 | dojo.declare('my.classes.zot', my.classes.bar, |
| | 56 | function(arg) { |
| | 57 | dojo.debug('zot: initializing instance' + (arg ? ' [' + arg + ']' : '')); |
| | 58 | this.id = 'zot'; |
| | 59 | }, |
| | 60 | { |
| | 61 | getId: function(extra) { |
| | 62 | return "I am a zot and " + my.classes.zot.superclass.getId.apply(this, arguments); |
| | 63 | } |
| | 64 | }); |
| | 65 | dojo.debug(''); |
| | 66 | |
| | 67 | dojo.debug('> f = new my.classes.foo()'); |
| | 68 | f = new my.classes.foo(); |
| | 69 | dojo.debug(''); |
| | 70 | |
| | 71 | dojo.debug('> z = new my.classes.zot("with an argument")'); |
| | 72 | z = new my.classes.zot("with an argument"); |
| | 73 | dojo.debug(''); |
| | 74 | |
| | 75 | dojo.debug('> f.getId()'); |
| | 76 | dojo.debug(f.getId()); |
| | 77 | dojo.debug(''); |
| | 78 | |
| | 79 | dojo.debug('> b.getId()'); |
| | 80 | dojo.debug(b.getId()); |
| | 81 | dojo.debug(''); |
| | 82 | |
| | 83 | dojo.debug('> z.getId()'); |
| | 84 | dojo.debug(z.getId()); |
| | 85 | dojo.debug(''); |
| | 86 | }); |