Skip to content

Commit

Permalink
Fixes #140 - IIFE namespacing pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
addyosmani committed Aug 31, 2014
1 parent 7394388 commit 864c1d6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions book/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8534,8 +8534,13 @@ <h3>5. Immediately-invoked Function Expressions (IIFE)s</h3>

// public methods and properties
namespace.foobar = "foobar";

namespace.say = function ( msg ) {
speak( msg );
};

namespace.sayHello = function () {
speak( "hello world" );
namespace.say( "hello world" );
};

// private method
Expand Down Expand Up @@ -8572,9 +8577,7 @@ <h3>5. Immediately-invoked Function Expressions (IIFE)s</h3>

// public method
namespace.sayGoodbye = function () {
console.log( namespace.foo );
console.log( namespace.bar );
speak( "goodbye" );
namespace.say( "goodbye" );
}
})( window.namespace = window.namespace || {});

Expand Down

0 comments on commit 864c1d6

Please sign in to comment.