I need the result of a promise in the next line of code, but I can't just include it in the .then of the promise as the containing function completes and then its to late.
Basically I have a bit of synchronous code and a but of async code. I need to have the sync code pause and wait for the the async to finish before continuing.
function outer () {
  it('1', function () {});
  it('2', function () {});
  it('3', function () {});
  var result = null;
  promise.then(function (r) {
    result = r;
  });
  // How do I wait for result to be
  // valid?
  if (result === true) {
    it('4', function () {});
  }
}
Please note, I can not do this...
function outer () {
  it('1', function () {});
  it('2', function () {});
  it('3', function () {});
  promise.then(function (result) {
    // It's to late to call it. The outer function is done
    // the it call here causes a throw
    if (result === true) {
      it('4', function () {});
    }
  });
}
 
     
    