yournamespacechoice
Global değişkene atanan kendi kendini çağıran anonim işlev . Tüm işlevleri ve değişkenleri bu işleve özel tutma etkisine hizmet eder. Bir işlevi veya değişkeni ortaya çıkarmak için, onu işlevin altında açıkça döndürmeliyiz. JQuery'yi $ olarak yeniden eşler.
var yournamespacechoice = (function ($) ( var publicfunction; function privatefunction() ( // function only available within parent function ) publicfunction = function publicfunction() ( // public function available outside of this funtion ); // Expose any functions that we need to access outside of this scope. Use yournamespacechoice.functionName() to call them. return ( publicfunction: publicfunction ); )(window.$));