Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving troubles implement my app in an Object Oriented manner
    primarykey
    data
    text
    <p>I've been coding JS for a while, but I've never did anything object oriented. I usually just defined all my variables at the top, and then just used them all. I kept hearing over and over to use OO, but now I can't do what I want and I can't get any help.</p> <p>Here is a fiddle, along with semi identical code:</p> <p><a href="http://jsfiddle.net/zDeAJ/1/" rel="nofollow">http://jsfiddle.net/zDeAJ/1/</a></p> <pre><code>var App = { options: { /* ------------------------------------ Options (PREFERABLY DONT CHANGE) --------------------------------------- */ baseDomain : 'google.com', apiVersion : '/api/v1' }, state: { current: App.options.baseDomain + App.options.apiVersion } } </code></pre> <p>So doing App.options.baseDomain (or this.options.baseDomain) won't work for me. What's the usefulness of defining Application level variables if I can't define other application level values based on them? I know this is a vague question but I really don't know what I'm asking... I just have a problem in that what I was easily able to accomplish with just a bunch of variables that held not only settings, but state within my application, is not so easy with my knowledge of Javascript OO patterns.... ​ Edit: Alright, this is specifically what I want to do:</p> <p><a href="http://i.imgur.com/ak5YD.png" rel="nofollow">http://i.imgur.com/ak5YD.png</a></p> <p>But I wasn't aware of the limitations... so I need a way around it, which sticks as close and elegant as possible to this implementation.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload