sketch = function(p) {

  var angle = 0;

  var linksLoading = false;
  var linksLoaded = false;
  var links = [];

  p.setup = function() {
    p.createCanvas(200, 200);

    p.strokeWeight(4);
  };

  p.draw = function() {
    // some animation
    p.background(255);
    p.translate(p.width / 2, p.height / 2);
    p.rotate(angle);
    angle += 0.02;
    p.line(-100, 0, 100, 0);

    // Has loading already started?
    if (linksLoading) {
      console.log('not loaded yet');
    }

    // Are the links already loaded?
    if (linksLoaded) {
      links.forEach(function(el, i) {
        console.log('Link ' + i + ': ' + el.title);
      });

      linksLoaded = false;
    }
  };

  p.mouseReleased = function() {
    console.log('Starting to load links');
    linksLoading = true;

    getLinks('Superegg', function(result) {
      linksLoaded = true;
      linksLoading = false;
      links = result;
    });
  };

  // Helping function that makes the queries to Wikipedia.
  function getLinks(title, callback, plcontinue, links) {
    links = links || [];

    $.ajax({
      url: 'http://en.wikipedia.org/w/api.php',
      data: {
        action: 'query',
        prop: 'links',
        pllimit: 'max',
        plcontinue: plcontinue,
        titles: title,
        format: 'json'
      },
      headers: { 'Api-User-Agent': 'M_6_2_01 (http://www.generative-gestaltung.de/; info@generative-gestaltung.de)' },
      dataType: 'jsonp',
      success: function(data) {
        var ids = Object.keys(data.query.pages);
        // Add the returned links to the array
        links = links.concat(data.query.pages[ids[0]].links);

        if (data.continue) {
          // A maximum of 500 results will be returned by Wikipedia,
          // so there might be some more requests necessary to get all results
          getLinks(title, callback, data.continue.plcontinue, links);

        } else {
          // If all is collected, deliver the results to the callback function
          callback(links);
        }
      }
    });
  }

}
loads an xml asynchronously, thus not disrupting the animation

MOUSE
left click          : starts loading the xml