Should I create accessor methods in my JavaScript app -


I used this form to configure my JS code

  window. APP = window.APP || (Function (global) {'strict experiment'; return} {operation: '', circulated: 0, results: '', init: function () {}};} (windowodoquam));  

A better way to do this is:

  var APP = API || (Function (global) {return} {init: function () {}};} (window.document));  

But in this way JSLint complains that the APP was not specifically launched in the second call of APP, in this section: "var APP = APP" then window.app works And JSLIT is found in the APP object. Window namespace

If you check the code block first, then I have three applications, detailed properties, operations, operations and results. I need those three accessory trenches that have used all my sub-actions and sub-objects so far to reach them:

  window.APP.operand = Global.getElementById ("operand"). Values;  

This works but the problem is that, the code looks very ugly overall and is stacked with extra unnecessary text. In my 250 lines of code, the "window.APP" prefix is ​​everywhere.

My question is, should I prepare specific setter methods to get / set all those properties or is there a better way to avoid that window. APP prefix?

Tell me the idea.

You should be able to combine two methods and use

  Var APP = Window.app || (Doctor) {"strict experiment"; ... return {...};} (document));  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -