'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _assembleData = require('./assembleData');

var _assembleData2 = _interopRequireDefault(_assembleData);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// 解决回调问题
var startProcess = function startProcess(props, stopLoading) {
  var processList = [{ next: function next() {
      return stopLoading(false);
    } }, _assembleData2.default];
  var nextFunc = function nextFunc(data) {
    var step = processList.pop();
    if (step) {
      (function () {
        var next = step.next;
        var ctrl = step.ctrl;
        next && next(data, props, function (res) {
          ctrl && ctrl(res, props, processList, stopLoading);
          nextFunc(res);
        }, stopLoading);
      })();
    }
  };
  nextFunc({});
}; /**
    * Created by baoyinghai on 12/23/16.
    * 开始 －a－－－－－－|－－－－－－>－－－－－－－－－－－跳转－－－－－－－－－结束
    *       ｜          |                      ｜                   ｜
    *       ｜          ^                      ^                    ｜
    *       ｜          |                      ｜                   ｜
    *       ｜          |       －－－－－－－－－c－－－－刷新－－－－－－
    *       ｜          |      ｜              ｜
    *       －－采集数据－－－请求b－－－－－－nextLink
    *                         ｜              ｜
    *                         ｜              ｜
    *                         ｜－－confirm－－｜
    * render      router
    * renderByKey router
    * renderByKeys router
    * deleteByKey request
    * deleteByKeys request
    * save  request
    * customer request
    *
    * 如果要提交数据发生post行为的 actionType 为request 否则时 router
    *
    */

exports.default = startProcess;