diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c25410 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +### Node template +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git +node_modules + +# Created by .ignore support plugin (hsz.mobi) diff --git a/Adapter/Duck.js b/Adapter/Duck.js deleted file mode 100644 index 73416f9..0000000 --- a/Adapter/Duck.js +++ /dev/null @@ -1,9 +0,0 @@ -var Duck = function(){ - -}; -Duck.prototype.fly = function(){ - throw new Error("This method must be overwritten!"); -}; -Duck.prototype.quack = function(){ - throw new Error("This method must be overwritten!"); -}; diff --git a/Adapter/MallardDuck.js b/Adapter/MallardDuck.js deleted file mode 100644 index 69ee871..0000000 --- a/Adapter/MallardDuck.js +++ /dev/null @@ -1,10 +0,0 @@ -var MallardDuck = function(){ - Duck.apply(this); -}; -MallardDuck.prototype = new Duck(); -MallardDuck.prototype.fly = function(){ - console.log("Can fly long distances!"); -}; -MallardDuck.prototype.quack = function(){ - console.log("Quack! Quack!"); -}; \ No newline at end of file diff --git a/Adapter/Turkey.js b/Adapter/Turkey.js deleted file mode 100644 index f29e0b7..0000000 --- a/Adapter/Turkey.js +++ /dev/null @@ -1,9 +0,0 @@ -var Turkey = function(){ - -}; -Turkey.prototype.fly = function(){ - throw new Error("This method must be overwritten!"); -}; -Turkey.prototype.gobble = function(){ - throw new Error("This method must be overwritten!"); -}; diff --git a/Adapter/TurkeyAdapter.js b/Adapter/TurkeyAdapter.js deleted file mode 100644 index 42535bf..0000000 --- a/Adapter/TurkeyAdapter.js +++ /dev/null @@ -1,16 +0,0 @@ -var TurkeyAdapter = function(oTurkey){ - Duck.apply(this); - this.oTurkey = oTurkey; -}; -TurkeyAdapter.prototype = new Duck(); -TurkeyAdapter.prototype.quack = function(){ - this.oTurkey.gobble(); -}; -TurkeyAdapter.prototype.fly = function(){ - var nFly = 0; - var nLenFly = 5; - for(; nFly < nLenFly;){ - this.oTurkey.fly(); - nFly = nFly + 1; - } -}; diff --git a/Adapter/WildTurkey.js b/Adapter/WildTurkey.js deleted file mode 100644 index f083ecf..0000000 --- a/Adapter/WildTurkey.js +++ /dev/null @@ -1,10 +0,0 @@ -var WildTurkey = function(){ - Turkey.apply(this); -}; -WildTurkey.prototype = new Turkey(); -WildTurkey.prototype.fly = function(){ - console.log("Fly short distance!"); -}; -WildTurkey.prototype.gobble = function(){ - console.log("Gobble! Gobble!"); -}; \ No newline at end of file diff --git a/Adapter/index.html b/Adapter/index.html index 508da1d..69fe56a 100644 --- a/Adapter/index.html +++ b/Adapter/index.html @@ -1,20 +1,19 @@ -
+-var oMallardDuck = new MallardDuck(); -var oWildTurkey = new WildTurkey(); -var oTurkeyAdapter = new TurkeyAdapter(oWildTurkey); +import MallardDuck from './MallardDuck'; +import WildTurkey from './WildTurkey'; +import TurkeyAdapter from './TurkeyAdapter'; + +let oMallardDuck = new MallardDuck(); +let oWildTurkey = new WildTurkey(); +let oTurkeyAdapter = new TurkeyAdapter(oWildTurkey); oMallardDuck.fly(); oMallardDuck.quack(); @@ -25,26 +24,15 @@-Source
oTurkeyAdapter.fly(); oTurkeyAdapter.quack();