StarShine(function(window, document, StarShine){ 'use strict'; //Immediately Invoked Inline Function //Define your application processes function _ApplicationProcess(window, document, StarShine){ var private = this;//share internal variables between other application processes //do some code here //APP will be defined here after the whole factory executes } //execute everything once var APP = StarShine(_ApplicationProcess)(window, document, StarShine); })(window, document, StarShine)