title: Error: Cannot read property of undefined (Vue)
body: <p>I want to give data from one component to another. Therefore the first component should emit the BusEvent when Data is updated. The updated function is called, but I always get an Error in my console: Error in updated hook: "TypeError: Cannot read property '$emit' of undefined"</p>
  
  <p>The other component also doesn´t receive height/width. And I get the same error here: TypeError: Cannot read property '$emit' of undefined.</p>
  
  <p>I just started learning vue and I don't understand whats wrong. Thanks a lot for your help!</p>
  
  <p>height and width are getting initialized in component one, so that can't be the problem.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//Definition of EventBus in main.js file
  export const EventBus = new Vue(); 
  
  //First Component
  import EventBus from '@/main.js'
  export default {
    data: function () {
      return {    
        height: '',
        width: ''
      }
    },
  
    updated() {
      EventBus.$emit('emited', this.height, this.width);
    }
  }
  
  
  //Second Component
  import EventBus from '@/main.js'
  export default {
    data: function () {
      return {
        height: '',
        width: ''
      }
    },
  
    mounted() {
      const self = this
      EventBus.$on('emited', function (height, width) {
        alert('WORKS!')
        self.height = height
        self.width = width
      })
    }
  }</code></pre>
  </div>
  </div>
  </p>