UNPKG

sententiaregum-flux-container

Version:

The flux implementation of the sententiaregum project based on facebook/flux

38 lines (32 loc) 841 B
/* * This file is part of the Sententiaregum project. * * (c) Maximilian Bosch <maximilian.bosch.27@gmail.com> * (c) Ben Bieler <benjaminbieler2014@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var creatorStore = [], objectStore = []; /** * Resolves a single store. * * @param {Function} actionCreator The action creator to resolve. * * @returns {Object} The action dictionary. */ exports.default = function (actionCreator) { var i = creatorStore.indexOf(actionCreator); if (-1 === i) { var result = actionCreator(); creatorStore.push(actionCreator); objectStore.push(result); return result; } return objectStore[i]; };