There are a number of patterns here, but the "revealing module pattern" is the most prominent.