-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdog.js
45 lines (45 loc) · 1.03 KB
/
dog.js
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
42
43
44
45
var Dog = (function () {
function Dog() {
}
Dog.prototype.Bark = function () {
console.log("Bark!!");
return this;
};
Dog.prototype.Scratch = function () {
return this;
};
Dog.prototype.Woof = function () {
return this;
};
Dog.prototype.GoOnWalk = function () {
return new WalkCommand(this);
};
Dog.prototype.GoForRun = function () {
return new RunCommand(this);
};
return Dog;
}());
var WalkCommand = (function () {
function WalkCommand(dog) {
this.dog = dog;
}
WalkCommand.prototype.GoToPark = function () {
return this;
};
WalkCommand.prototype.GoHome = function () {
return this.dog;
};
return WalkCommand;
}());
var RunCommand = (function () {
function RunCommand(dog) {
this.dog = dog;
}
RunCommand.prototype.RunToPark = function () {
return this;
};
RunCommand.prototype.GoHome = function () {
return this.dog;
};
return RunCommand;
}());