'use strict';12var _interopRequire = function (obj) { return obj && obj.__esModule ? obj['default'] : obj; };34module.exports = fluxMixin;5/**6* fluxMixin7*8* Exports a function that creates a React component mixin. Implements methods9* from reactComponentMethods.10*11* Any arguments passed to the mixin creator are passed to `connectToStores()`12* and used as the return value of `getInitialState()`. This lets you handle13* all of the state initialization and updates in a single place, while removing14* the burden of manually adding and removing store listeners.15*16* @example17* let Component = React.createClass({18* mixins: [fluxMixin({19* storeA: store => ({20* foo: store.state.a,21* }),22* storeB: store => ({23* bar: store.state.b,24* })25* }]26* });27*/2829var _PropTypes = require('react');3031var _Flux = require('../Flux');3233var _instanceMethods$staticProperties = require('./reactComponentMethods');3435var _assign = require('object-assign');3637var assign = _interopRequire(_assign);3839function fluxMixin() {40for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {41args[_key] = arguments[_key];42}4344function getInitialState() {45this.initialize();46return this.connectToStores.apply(this, args);47}4849return assign({ getInitialState: getInitialState }, _instanceMethods$staticProperties.instanceMethods, _instanceMethods$staticProperties.staticProperties);50}5152;5354