<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>encapsulation on Curtis Timson</title><link>https://hugo.curtiscode.dev/tags/encapsulation/</link><description>Recent content in encapsulation on Curtis Timson</description><generator>Hugo -- gohugo.io</generator><language>en-GB</language><lastBuildDate>Thu, 09 Oct 2014 00:00:00 +0000</lastBuildDate><atom:link href="https://hugo.curtiscode.dev/tags/encapsulation/index.xml" rel="self" type="application/rss+xml"/><item><title>Mixing Revealing Module and Singleton Javascript Patterns</title><link>https://hugo.curtiscode.dev/post/js/mixing-revealing-module-and-singleton-javascript-patterns/</link><pubDate>Thu, 09 Oct 2014 00:00:00 +0000</pubDate><guid>https://hugo.curtiscode.dev/post/js/mixing-revealing-module-and-singleton-javascript-patterns/</guid><description>Until recently I&amp;rsquo;ve been using the Singleton pattern for my javascript objects.
This works well as my functions are namespaced and therefore the risk of clashing object names across Javascript files is reduced.
For this example I&amp;rsquo;ve created a singleton pattern javascript object which will show an alert window displaying &amp;ldquo;hello world&amp;rdquo;.
var MyFunction = { Init: function(){ this.Config.foo = &amp;#34;hello world&amp;#34;; }, Config:{ foo:null }, ShowAlert:function(){ alert(this.</description></item></channel></rss>