profile

Coffeescript with RequireJS and the Revealing Module Pattern

javascript, requirejs, revealing module

The Story

     In an attempt to learn more about Coffeescript, I started to look at the syntax in relation to the current module development that I was engaging in. Specifically, I had been engaged with RequireJS for module development and wanted to see how that would play out with Coffeescript (defining functions in Require is kinda a weird syntax). Yet another requirement I had was to use the Revealing Module Pattern, so that I can define one set of external methods that anyone can consume in my app while keeping the internal implementation separate. With all of that, here is the code:

What I want want it to look like:

The Coffeescript code to get this type of output:

Hope that helps somebody somewhere!