var loadManyReferenceList = require('./builder').loadMany;
var dispatcher = require('../dispatcher');
module.exports =
function(referenceNames){
  return function(){
       return Promise.all(loadManyReferenceList(referenceNames))
           .then(function successReferenceLoading(data){
             dispatcher.handleViewAction({data: data, type: 'update'});
           }, function errorReferenceLoading(err){
             dispatcher.handleViewAction({data: err, type: 'error'});
           });
     };
};

var loadManyReferenceList = require('./builder').loadMany;
var dispatcher = require('../dispatcher');

/**
 * Focus reference action.
 * @param {array} referenceNames - An array which contains the name of all the references to load.
 * @returns {Promise} - The promise of loading all the references.
 */
function builtInReferenceAction(referenceNames){
  return function(){
       return Promise.all(loadManyReferenceList(referenceNames))
           .then(function successReferenceLoading(data){
             //Rebuilt a constructed information from the map.
             var reconstructedData = {};
             referenceNames.map((name, index)=>{
               reconstructedData[name] = data[index];
             });
             //
             dispatcher.handleViewAction({data: reconstructedData, type: 'update', subject: 'reference'});
           }, function errorReferenceLoading(err){
             dispatcher.handleViewAction({data: err, type: 'error'});
           });
     };
}

module.exports = builtInReferenceAction;

Change the buildin action of the refernece.
[reference] Change the buildin action of the refernece.
