JavaScript, JavaScript…

by Angus Croll

  Follow angusTweets on TwitterFollow me on GitHub
I also blog here...
Angus on Svbtle

...and I wrote this...
If Hemingway wrote JavaScript

..and I gave these talks...
Parlez-vous JavaScript
Break all the Rulez










Tag Archives for module pattern

The module pattern (in a nutshell)

The module pattern (first publicized by the Yahoo! JavaScript team) makes use of closures to bake privacy and state into your objects.

This is the generic form…

function() {
    //private state
    //private functions
    return {
         //public state
         //public variables
    }
}

Continue reading →

April 22, 2010 by Angus Croll | Tags: closures, module pattern, private | 11 Comments

Post navigation

Blog at WordPress.com. | Theme: Ari by Elmastudio.
Follow

Get every new post delivered to your Inbox.

Join 356 other followers

Powered by WordPress.com