forked from dominictobias/extnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (34 loc) · 752 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<title>extnd demo</title>
<script src="extnd.js"></script>
</head>
<body>
<script>
var Animal = Class.extnd({
init: function(name) {
this.name = name;
},
getAge: function() {
return '9 million years old';
}
});
var Bird = Animal.extnd({
wings: 'wings',
init: function(name) {
this._super.apply(this, arguments);
console.log('I am a bird, animal tells me my name is', this.name);
}
});
var HummingBird = Animal.extnd(Bird).extnd({
init: function(name) {
this._super.apply(this, arguments);
console.log('Hummingbirds have', this.wings);
console.log('Hummingbirds are', this.getAge());
}
});
var hummingBird = new HummingBird('FlappyPappy');
</script>
</body>
</html>