diff --git a/Nullify/Nullify.js b/Nullify/Nullify.js index b618e86..92e8453 100644 --- a/Nullify/Nullify.js +++ b/Nullify/Nullify.js @@ -4,6 +4,9 @@ Nullify.prototype.fillContent = function() var oTest1 = document.getElementById("test1"); var oTest2 = document.getElementById("test2"); var oTest3 = document.getElementById("test3"); + oTest1.onclick = function () {}; + oTest2.onclick = function () {}; + oTest3.onclick = function () {}; oTest1.innerHTML = 'TEST 1'; oTest2.innerHTML = 'TEST 2'; diff --git a/Nullify/examples/Background_Links.txt b/Nullify/examples/Background_Links.txt new file mode 100644 index 0000000..8abd339 --- /dev/null +++ b/Nullify/examples/Background_Links.txt @@ -0,0 +1,5 @@ +http://javascript.crockford.com/memory/leak.html +http://geekswithblogs.net/FrostRed/archive/2008/11/29/127440.aspx +http://www.ibm.com/developerworks/web/library/wa-memleak/ +http://msdn.microsoft.com/en-us/library/Bb250448 +http://buildnewgames.com/garbage-collector-friendly-code/ \ No newline at end of file diff --git a/Nullify/examples/problem/index.html b/Nullify/examples/problem/index.html new file mode 100644 index 0000000..7915c60 --- /dev/null +++ b/Nullify/examples/problem/index.html @@ -0,0 +1,15 @@ + +
+ + + \ No newline at end of file diff --git a/Nullify/examples/solution/index.html b/Nullify/examples/solution/index.html new file mode 100644 index 0000000..3532b52 --- /dev/null +++ b/Nullify/examples/solution/index.html @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 7254a8d..23e04f0 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ This will be a repository of how to use the Design Patterns from *Gang of Four* ## Update: Added new Design Patterns exclusive from Javascript. -Added changes to index.html. Now you can check the code to be executed and the execution without to have open console. Thanks -adamnbowen- +Added changes to index.html. Now you can check the code to be executed and the execution without open the console. Thanks -adamnbowen- -## Design Patterns that you can found in this repository: +## Design Patterns that you can find in this repository: * Adapter * Command @@ -44,4 +44,6 @@ All constructive comments are welcome. I promise I will answer everyone. [Head First Design Patterns](http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124/ref=sr_1_1?ie=UTF8&qid=1316512770&sr=8-1) -[Pro Javascript Design Patterns](http://www.amazon.com/Pro-JavaScript-Design-Patterns-ebook/dp/B001AT1YUA/ref=sr_1_2?ie=UTF8&qid=1317818607&sr=8-2) +[Pro Javascript Design Patterns](http://www.amazon.com/Pro-JavaScript-Design-Patterns-Object-Oriented/dp/159059908X) + +__ diff --git a/Strategy/4/MallardDuck.js b/Strategy/4/MallardDuck.js index 93f24dd..cfac889 100644 --- a/Strategy/4/MallardDuck.js +++ b/Strategy/4/MallardDuck.js @@ -1,7 +1,7 @@ var MallardDuck = function(){ Duck.apply(this); - this.oFlyBehavior = new Quack(); - this.oQuackBehavior = new FlyWithWings(); + this.oFlyBehavior = new FlyWithWings(); + this.oQuackBehavior = new Quack(); }; MallardDuck.prototype = new Duck(); MallardDuck.prototype.display = function(){ diff --git a/Strategy/4/RedheadDuck.js b/Strategy/4/RedheadDuck.js index fbf693a..f065df7 100644 --- a/Strategy/4/RedheadDuck.js +++ b/Strategy/4/RedheadDuck.js @@ -1,7 +1,7 @@ var RedheadDuck = function(){ Duck.apply(this); - this.oFlyBehavior = new Quack(); - this.oQuackBehavior = new FlyWithWings(); + this.oFlyBehavior = new FlyWithWings(); + this.oQuackBehavior = new Quack(); }; RedheadDuck.prototype = new Duck(); RedheadDuck.prototype.display = function(){ diff --git a/Try-Finally/TryFinally.js b/Try-Finally/TryFinally.js index e679dfe..03448f0 100644 --- a/Try-Finally/TryFinally.js +++ b/Try-Finally/TryFinally.js @@ -4,7 +4,9 @@ TryFinally.prototype.getContent = function() var oTest1 = document.getElementById("test1"); var oTest2 = document.getElementById("test2"); var oTest3 = document.getElementById("test3"); - + oTest1.onclick = function () {}; + oTest2.onclick = function () {}; + oTest3.onclick = function () {}; try { return { diff --git a/Try-Finally/examples/problem/index.html b/Try-Finally/examples/problem/index.html new file mode 100644 index 0000000..26b0c63 --- /dev/null +++ b/Try-Finally/examples/problem/index.html @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/Try-Finally/examples/solution/index.html b/Try-Finally/examples/solution/index.html new file mode 100644 index 0000000..9877189 --- /dev/null +++ b/Try-Finally/examples/solution/index.html @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file