willconant / flow-js

Javascript Library for Multi-step Asynchronous Logic
MIT License
302 stars 15 forks source link

flow.exec doesn't seem to work properly on Windows Phone 7.5 or IE7 #6

Open alexblack opened 12 years ago

alexblack commented 12 years ago

Not sure if you are interested in supporting these browsers (I am !) Great little library you have here.

In my code below, the second function in the flow gets called before both callbacks when on IE, but in Chrome, the iPad, etc it works fine.

// in parallel start the transition and the XHR
var count = 0;
flow.exec(
  function() {
    // Start the CSS transition to hide
    var transMulti = this.MULTI();
    $control.parent().addClassTrans('removed', function() { count++; transMulti(); });

    // In parallel, tell the server to hide facets
    var xhrMulti = this.MULTI();
    x$(document).xhr(url, {
      data: 'facet=' + facetName,
      async: true,
      method: 'post',
      callback: function() { count++; xhrMulti(); }
    });                  
  },
  function() {          
    if (count != 2)
      alert('fucked: ' + count);
    // if we're selected, then hide our value pane
    if (selected) 
      hideValues();

    // actually remove it, now that its hidden
    $control.parent().remove();
    // fetch new facets            
    updateSuggested();
  }
);