title: Initialize Vue.prototype before component loads
body: <p>My code uses plugins feature in Vuejs to define global shared variable. </p>
  
  <pre><code>Vue.use(shared)
  </code></pre>
  
  <p><code>shared</code> is defined as:- </p>
  
  <pre><code>export const shared = {
    config: getAppConfig()
  }
  shared.install = function() {
    Object.defineProperty(Vue.prototype, '$shared', {
      get() {
        return shared
      }
    })
  }
  
  function getAppConfig() {
    var api = getAPIURL()
    return axios.get("https://url/get_config")
    .then(response =&gt; {
      return response.data
    }
  }
  </code></pre>
  
  <p>My issue is, in my component, if I use this variable <code>this.$shared.config</code>, I get <code>undefined</code>. </p>
  
  <p>Looking at the console window and debug statement, my component code is executed before the plugin got time to <code>this.$shared.config</code>.</p>
  
  <p>I'm new to javascript+Vuejs but when I researched about this error, it is related to axios being asynchronous so I decided to return promise and use await. </p>
  
  <pre><code>function getAppConfig() {
    var api = getAPIURL()
    return axios.get("https://url/get_config")
  }
  </code></pre>
  
  <p>But, when in my <code>shared.install</code> function, I try do:- </p>
  
  <pre><code>shared.install = function() {
    let config = await shared.config
  </code></pre>
  
  <p>I get error: <code>Syntax Error: await is a reserved word</code>.</p>
  
  <p>Since I'm new, it looks like I'm doing a fundamental error in how I should make this code synchronous. What's the right way to fix this?</p>