Created
June 20, 2012 08:18
Revisions
-
imbcmdth revised this gist
Jun 20, 2012 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,22 @@ (function (global) { 'use strict'; var x = 10, button = document.getElementById('idButton'), output = document.getElementById('idOutput'); button.addEventListener("click", function () { output.innerHTML = x++; }); global.appSpace = { z : 0, appSum: function (y) { return x + y; }, appMult: function (y) { return x * y; }, @@ -30,7 +30,7 @@ var appSpace = (function (global) { } }; })(window); appSpace.getOutput().innerHTML = appSpace.appMult(5) + '<br />'; appSpace.getOutput().innerHTML += appSpace.appSum(5); -
Scott Sanbar created this gist
Jun 20, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ <html> <head> <title>IIFE App</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <input type="button" id="idButton" value="Click Me!"> <div id="idOutput"></div> <script type="text/javascript" src="LoadIIFE.js"></script> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ var appSpace = (function (global) { 'use strict'; var x = 10, button = document.getElementById('idButton'), output = document.getElementById('idOutput'); global.appSum = function (y) { return x + y; }; button.addEventListener("click", function () { output.innerHTML = x++; }); return { z : 0, appMult: function (y) { return x * y; }, setX: function (y) { x = y; }, getOutput: function () { return output; } }; }(window)); appSpace.getOutput().innerHTML = appSpace.appMult(5) + '<br />'; appSpace.getOutput().innerHTML += appSum(5);