title: Vuejs component wait for facebook sdk to load
body: <p>I have a component that show a login button or username of the user from facebook.
  depends if he is logged in or not.</p>
  
  <p>Now in this component I use the</p>
  
  <pre><code>created
  </code></pre>
  
  <p>event so I'll check the login immidiatly.
  code in created in a brief:</p>
  
  <pre><code>FB.getLoginStatus(function(response) {
      //more things.....
  </code></pre>
  
  <p>the error is that it says that FB is not defined,
  and sure he is right, FB is not loaded yet.</p>
  
  <p>I load facebook like this</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;body&gt;
  &lt;script&gt;
    window.fbAsyncInit = function() {
    FB.init({
      appId      : '1111111111',
      xfbml      : true,
      version    : 'v2.7'
    });
  };
  
  (function(d, s, id){
   var js, fjs = d.getElementsByTagName(s)[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement(s); js.id = id;
   js.src = "//connect.facebook.net/en_US/sdk.js";
   fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
  &lt;/script&gt;
  </code></pre>