title: When and where may I load data, from a remote API, in my Ember.js application?
body: <p>I'm learning Ember.js, and am writing an application that I want to perform the following tasks ...</p>
  
  <ol>
  <li>load some data from local storage</li>
  <li>check 3rd party API for new additional data</li>
  <li>append any additional and save entire thing back to local storage</li>
  <li>display a table of this data</li>
  </ol>
  
  <p>My application is just a single route. I'm using the <code>Ember.Route</code>'s <code>model</code> hook to load data from local storage. Where is a good spot to check that 3rd party API for any new data, though? Should I also do this in the <code>model</code> hook? I'd like to be able to display some sort of loading icon during the query to the 3rd party API and I'm not sure if that <code>model</code> hook will allow me to do this?</p>
  
  <p>Right now, my <code>Route</code> only contains the following code ...</p>
  
  <pre><code>App.HistoryRoute = Ember.Route.extend({
  
      model: function (params) {
  
          // initialize model
          var model = { summoner: params, history: [] };
  
          if (typeof(localStorage.history) == 'undefined')
              return model;
  
          // fetch the data from local storage
          var history = JSON.parse(localStorage.history);
  
          // check for existing data
          if (!history.hasOwnKey(params.region) || !history[params.region].hasOwnKey(params.name))
              return model;
  
          // use the data from local storage
          return history[params.region][params.name];
  
      }
  
  });
  </code></pre>
  
  <p>The data in local storage is namespaced using a region and name. It looks something like this ...</p>
  
  <pre><code>{
    "NorthAmerica": {
      "ryan": {
        "summoner": { "region": "NorthAmerica", "name": "ryan" },
        "history": [ ... ]
      }
    }
  }
  </code></pre>
  
  <p>So, the <code>Route</code>'s <code>model</code> method loads that data so that it can be used as the model. Where should I hit the 3rd party API to get new data, though? I'd like to check it for new data each time the page is refreshed. Thanks!</p>