view source
Using Method Chaining With The Revealing Module Pattern In JavaScript
Yesterday, I looked at creating null-prototype objects in Node.js. As part of that exploration, I created a very simple cache class with public methods that could be chained. However, since the public methods were exposed using the revealing module pattern, it dawned on me that the "this" reference works; but, it works in a very interesting way. When using method chaining, in conjunction with the revealing module pattern, you can only use "this" to refer to public methods.