Comparing version 0.16.2 to 0.16.3
# Changelog | ||
## 0.16.3 | ||
### Dependencies | ||
* Updates es-symbol. | ||
## 0.16.2 | ||
@@ -4,0 +10,0 @@ |
333
dist/alt.js
@@ -386,3 +386,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Alt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
/** | ||
* Copyright (c) 2014, Facebook, Inc. | ||
* Copyright (c) 2014-2015, Facebook, Inc. | ||
* All rights reserved. | ||
@@ -735,8 +735,2 @@ * | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -746,6 +740,12 @@ value: true | ||
var _import = require('./symbols/symbols'); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var Sym = _interopRequireWildcard(_import); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var ACTION_HANDLER = Sym.ACTION_HANDLER; | ||
@@ -781,8 +781,2 @@ var ACTION_UID = Sym.ACTION_UID; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -792,18 +786,26 @@ value: true | ||
var _EventEmitter = require('eventemitter3'); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _EventEmitter2 = _interopRequireWildcard(_EventEmitter); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _assign = require('object-assign'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _Symbol = require('es-symbol'); | ||
var _eventemitter3 = require('eventemitter3'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _eventemitter32 = _interopRequireDefault(_eventemitter3); | ||
var _import = require('./symbols/symbols'); | ||
var _objectAssign = require('object-assign'); | ||
var Sym = _interopRequireWildcard(_import); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var ALL_LISTENERS = Sym.ALL_LISTENERS; | ||
@@ -816,3 +818,3 @@ var LIFECYCLE = Sym.LIFECYCLE; | ||
// event emitter instance | ||
var EE = _Symbol2['default'](); | ||
var EE = _esSymbol2['default'](); | ||
@@ -825,3 +827,3 @@ var AltStore = (function () { | ||
this[EE] = new _EventEmitter2['default'](); | ||
this[EE] = new _eventemitter32['default'](); | ||
this[LIFECYCLE] = {}; | ||
@@ -834,7 +836,7 @@ this[STATE_CONTAINER] = state || model; | ||
if (typeof this.StoreModel === 'object') { | ||
this.StoreModel.state = _assign2['default']({}, StoreModel.state); | ||
this.StoreModel.state = _objectAssign2['default']({}, StoreModel.state); | ||
} | ||
_assign2['default'](this[LIFECYCLE], model[LIFECYCLE]); | ||
_assign2['default'](this, model[PUBLIC_METHODS]); | ||
_objectAssign2['default'](this[LIFECYCLE], model[LIFECYCLE]); | ||
_objectAssign2['default'](this, model[PUBLIC_METHODS]); | ||
@@ -919,4 +921,2 @@ // Register dispatcher | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -926,48 +926,50 @@ value: true | ||
var _Symbol = require('es-symbol'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
// action creator handler | ||
var ACTION_HANDLER = _Symbol2['default'](); | ||
var ACTION_HANDLER = _esSymbol2['default'](); | ||
exports.ACTION_HANDLER = ACTION_HANDLER; | ||
// the action's uid symbol for listening | ||
var ACTION_KEY = _Symbol2['default'](); | ||
var ACTION_KEY = _esSymbol2['default'](); | ||
exports.ACTION_KEY = ACTION_KEY; | ||
// per instance registry of actions | ||
var ACTIONS_REGISTRY = _Symbol2['default'](); | ||
var ACTIONS_REGISTRY = _esSymbol2['default'](); | ||
exports.ACTIONS_REGISTRY = ACTIONS_REGISTRY; | ||
// the action's name | ||
var ACTION_UID = _Symbol2['default'](); | ||
var ACTION_UID = _esSymbol2['default'](); | ||
exports.ACTION_UID = ACTION_UID; | ||
// store all of a store's listeners | ||
var ALL_LISTENERS = _Symbol2['default'](); | ||
var ALL_LISTENERS = _esSymbol2['default'](); | ||
exports.ALL_LISTENERS = ALL_LISTENERS; | ||
// initial snapshot | ||
var INIT_SNAPSHOT = _Symbol2['default'](); | ||
var INIT_SNAPSHOT = _esSymbol2['default'](); | ||
exports.INIT_SNAPSHOT = INIT_SNAPSHOT; | ||
// last snapshot | ||
var LAST_SNAPSHOT = _Symbol2['default'](); | ||
var LAST_SNAPSHOT = _esSymbol2['default'](); | ||
exports.LAST_SNAPSHOT = LAST_SNAPSHOT; | ||
// all lifecycle listeners | ||
var LIFECYCLE = _Symbol2['default'](); | ||
var LIFECYCLE = _esSymbol2['default'](); | ||
exports.LIFECYCLE = LIFECYCLE; | ||
// store action listeners | ||
var LISTENERS = _Symbol2['default'](); | ||
var LISTENERS = _esSymbol2['default'](); | ||
exports.LISTENERS = LISTENERS; | ||
// public methods | ||
var PUBLIC_METHODS = _Symbol2['default'](); | ||
var PUBLIC_METHODS = _esSymbol2['default'](); | ||
exports.PUBLIC_METHODS = PUBLIC_METHODS; | ||
// contains all state | ||
var STATE_CONTAINER = _Symbol2['default'](); | ||
var STATE_CONTAINER = _esSymbol2['default'](); | ||
exports.STATE_CONTAINER = STATE_CONTAINER; | ||
@@ -1037,4 +1039,2 @@ | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -1048,10 +1048,14 @@ value: true | ||
var _assign = require('object-assign'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _import = require('../symbols/symbols'); | ||
var _objectAssign = require('object-assign'); | ||
var Sym = _interopRequireWildcard(_import); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var INIT_SNAPSHOT = Sym.INIT_SNAPSHOT; | ||
@@ -1072,3 +1076,3 @@ var LAST_SNAPSHOT = Sym.LAST_SNAPSHOT; | ||
} | ||
_assign2['default'](store[STATE_CONTAINER], obj[key]); | ||
_objectAssign2['default'](store[STATE_CONTAINER], obj[key]); | ||
onStore(store); | ||
@@ -1117,4 +1121,2 @@ } | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -1124,8 +1126,10 @@ value: true | ||
var _Symbol = require('es-symbol'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol = require('es-symbol'); | ||
var _ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS = require('../symbols/symbols'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var StoreMixinEssentials = { | ||
@@ -1159,3 +1163,3 @@ waitFor: function waitFor(sources) { | ||
_this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.PUBLIC_METHODS][methodName] = methods[methodName]; | ||
_this[_symbolsSymbols.PUBLIC_METHODS][methodName] = methods[methodName]; | ||
}); | ||
@@ -1172,3 +1176,3 @@ }, | ||
on: function on(lifecycleEvent, handler) { | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.LIFECYCLE][lifecycleEvent] = handler.bind(this); | ||
this[_symbolsSymbols.LIFECYCLE][lifecycleEvent] = handler.bind(this); | ||
}, | ||
@@ -1185,9 +1189,9 @@ | ||
if (handler.length > 1) { | ||
throw new TypeError('Action handler in store ' + this._storeName + ' for ' + ('' + (symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] || symbol).toString() + ' was defined with 2 ') + 'parameters. Only a single parameter is passed through the ' + 'dispatcher, did you mean to pass in an Object instead?'); | ||
throw new TypeError('Action handler in store ' + this._storeName + ' for ' + ('' + (symbol[_symbolsSymbols.ACTION_KEY] || symbol).toString() + ' was defined with 2 ') + 'parameters. Only a single parameter is passed through the ' + 'dispatcher, did you mean to pass in an Object instead?'); | ||
} | ||
// You can pass in the constant or the function itself | ||
var key = symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] ? symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] : symbol; | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.LISTENERS][key] = handler.bind(this); | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ALL_LISTENERS].push(_Symbol2['default'].keyFor(key)); | ||
var key = symbol[_symbolsSymbols.ACTION_KEY] ? symbol[_symbolsSymbols.ACTION_KEY] : symbol; | ||
this[_symbolsSymbols.LISTENERS][key] = handler.bind(this); | ||
this[_symbolsSymbols.ALL_LISTENERS].push(_esSymbol2['default'].keyFor(key)); | ||
}, | ||
@@ -1250,15 +1254,11 @@ | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _bind = Function.prototype.bind; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x, | ||
property = _x2, | ||
receiver = _x3; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.createStoreConfig = createStoreConfig; | ||
@@ -1269,15 +1269,21 @@ exports.transformStore = transformStore; | ||
var _assign = require('object-assign'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var _objectAssign = require('object-assign'); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _AltStore = require('../AltStore'); | ||
var _AltStore2 = _interopRequireWildcard(_AltStore); | ||
var _AltStore2 = _interopRequireDefault(_AltStore); | ||
var _getInternalMethods = require('./AltUtils'); | ||
var _AltUtils = require('./AltUtils'); | ||
var _StoreMixinEssentials$StoreMixinListeners = require('./StoreMixins'); | ||
var _StoreMixins = require('./StoreMixins'); | ||
var _ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER = require('../symbols/symbols'); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
@@ -1291,5 +1297,5 @@ function doSetState(store, storeInstance, state) { | ||
var nextState = typeof state === 'function' ? state(storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER]) : state; | ||
var nextState = typeof state === 'function' ? state(storeInstance[_symbolsSymbols.STATE_CONTAINER]) : state; | ||
storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER] = config.setState.call(store, storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER], nextState); | ||
storeInstance[_symbolsSymbols.STATE_CONTAINER] = config.setState.call(store, storeInstance[_symbolsSymbols.STATE_CONTAINER], nextState); | ||
@@ -1302,3 +1308,3 @@ if (!store.alt.dispatcher.isDispatching()) { | ||
function createStoreConfig(globalConfig, StoreModel) { | ||
StoreModel.config = _assign2['default']({ | ||
StoreModel.config = _objectAssign2['default']({ | ||
getState: function getState(state) { | ||
@@ -1310,3 +1316,3 @@ return Object.keys(state).reduce(function (obj, key) { | ||
}, | ||
setState: _assign2['default'] | ||
setState: _objectAssign2['default'] | ||
}, globalConfig, StoreModel.config); | ||
@@ -1325,7 +1331,7 @@ } | ||
var StoreProto = {}; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.ALL_LISTENERS] = []; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LIFECYCLE] = {}; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LISTENERS] = {}; | ||
StoreProto[_symbolsSymbols.ALL_LISTENERS] = []; | ||
StoreProto[_symbolsSymbols.LIFECYCLE] = {}; | ||
StoreProto[_symbolsSymbols.LISTENERS] = {}; | ||
_assign2['default'](StoreProto, { | ||
_objectAssign2['default'](StoreProto, { | ||
_storeName: key, | ||
@@ -1340,3 +1346,3 @@ alt: alt, | ||
} | ||
}, _StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners, _StoreMixinEssentials$StoreMixinListeners.StoreMixinEssentials, StoreModel); | ||
}, _StoreMixins.StoreMixinListeners, _StoreMixins.StoreMixinEssentials, StoreModel); | ||
@@ -1346,3 +1352,3 @@ // bind the store listeners | ||
if (StoreProto.bindListeners) { | ||
_StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners.bindListeners.call(StoreProto, StoreProto.bindListeners); | ||
_StoreMixins.StoreMixinListeners.bindListeners.call(StoreProto, StoreProto.bindListeners); | ||
} | ||
@@ -1354,3 +1360,3 @@ | ||
Object.keys(StoreProto.lifecycle).forEach(function (event) { | ||
_StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners.on.call(StoreProto, event, StoreProto.lifecycle[event]); | ||
_StoreMixins.StoreMixinListeners.on.call(StoreProto, event, StoreProto.lifecycle[event]); | ||
}); | ||
@@ -1360,3 +1366,3 @@ } | ||
// create the instance and assign the public methods to the instance | ||
storeInstance = _assign2['default'](new _AltStore2['default'](alt, StoreProto, StoreProto.state, StoreModel), StoreProto.publicMethods, { displayName: key }); | ||
storeInstance = _objectAssign2['default'](new _AltStore2['default'](alt, StoreProto, StoreProto.state, StoreModel), StoreProto.publicMethods, { displayName: key }); | ||
@@ -1394,3 +1400,3 @@ return storeInstance; | ||
_assign2['default'](Store.prototype, _StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners, _StoreMixinEssentials$StoreMixinListeners.StoreMixinEssentials, { | ||
_objectAssign2['default'](Store.prototype, _StoreMixins.StoreMixinListeners, _StoreMixins.StoreMixinEssentials, { | ||
_storeName: key, | ||
@@ -1407,10 +1413,10 @@ alt: alt, | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.ALL_LISTENERS] = []; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LIFECYCLE] = {}; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LISTENERS] = {}; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.PUBLIC_METHODS] = {}; | ||
Store.prototype[_symbolsSymbols.ALL_LISTENERS] = []; | ||
Store.prototype[_symbolsSymbols.LIFECYCLE] = {}; | ||
Store.prototype[_symbolsSymbols.LISTENERS] = {}; | ||
Store.prototype[_symbolsSymbols.PUBLIC_METHODS] = {}; | ||
var store = new (_bind.apply(Store, [null].concat(argsForClass)))(); | ||
storeInstance = _assign2['default'](new _AltStore2['default'](alt, store, store[alt.config.stateKey] || store[config.stateKey] || null, StoreModel), _getInternalMethods.getInternalMethods(StoreModel), { displayName: key }); | ||
storeInstance = _objectAssign2['default'](new _AltStore2['default'](alt, store, store[alt.config.stateKey] || store[config.stateKey] || null, StoreModel), _AltUtils.getInternalMethods(StoreModel), { displayName: key }); | ||
@@ -1423,4 +1429,2 @@ return storeInstance; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -1431,15 +1435,19 @@ value: true | ||
var _import = require('../symbols/symbols'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var Sym = _interopRequireWildcard(_import); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _Symbol = require('es-symbol'); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _AltAction = require('../AltAction'); | ||
var _AltAction2 = _interopRequireWildcard(_AltAction); | ||
var _AltAction2 = _interopRequireDefault(_AltAction); | ||
var _uid = require('./AltUtils'); | ||
var _AltUtils = require('./AltUtils'); | ||
@@ -1452,5 +1460,5 @@ var ACTION_KEY = Sym.ACTION_KEY; | ||
// make sure each Symbol is unique | ||
var actionId = _uid.uid(alt[ACTIONS_REGISTRY], '' + namespace + '.' + name); | ||
var actionId = _AltUtils.uid(alt[ACTIONS_REGISTRY], '' + namespace + '.' + name); | ||
alt[ACTIONS_REGISTRY][actionId] = 1; | ||
var actionSymbol = _Symbol2['default']['for']('alt/' + actionId); | ||
var actionSymbol = _esSymbol2['default']['for']('alt/' + actionId); | ||
@@ -1483,3 +1491,3 @@ var data = { | ||
var container = alt.actions[namespace]; | ||
var id = _uid.uid(container, name); | ||
var id = _AltUtils.uid(container, name); | ||
container[id] = action; | ||
@@ -1495,35 +1503,36 @@ | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _bind = Function.prototype.bind; | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x3, | ||
property = _x4, | ||
receiver = _x5; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _assign = require('object-assign'); | ||
var _objectAssign = require('object-assign'); | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _Dispatcher = require('flux'); | ||
var _flux = require('flux'); | ||
var _makeAction = require('./utils/makeAction'); | ||
var _utilsMakeAction = require('./utils/makeAction'); | ||
var _makeAction2 = _interopRequireWildcard(_makeAction); | ||
var _utilsMakeAction2 = _interopRequireDefault(_utilsMakeAction); | ||
var _filterSnapshots$saveInitialSnapshot$setAppState$snapshot = require('./utils/StateFunctions'); | ||
var _utilsStateFunctions = require('./utils/StateFunctions'); | ||
var _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore = require('./utils/StoreUtils'); | ||
var _utilsStoreUtils = require('./utils/StoreUtils'); | ||
var _ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE = require('./symbols/symbols'); | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn = require('./utils/AltUtils'); | ||
var _utilsAltUtils = require('./utils/AltUtils'); | ||
@@ -1539,9 +1548,9 @@ var Alt = (function () { | ||
this.deserialize = config.deserialize || JSON.parse; | ||
this.dispatcher = config.dispatcher || new _Dispatcher.Dispatcher(); | ||
this.dispatcher = config.dispatcher || new _flux.Dispatcher(); | ||
this.actions = { global: {} }; | ||
this.stores = {}; | ||
this.storeTransforms = config.storeTransforms || []; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTIONS_REGISTRY] = {}; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT] = {}; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT] = {}; | ||
this[_symbolsSymbols.ACTIONS_REGISTRY] = {}; | ||
this[_symbolsSymbols.INIT_SNAPSHOT] = {}; | ||
this[_symbolsSymbols.LAST_SNAPSHOT] = {}; | ||
} | ||
@@ -1562,6 +1571,6 @@ | ||
var key = StoreModel.displayName || ''; | ||
_createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreConfig(this.config, StoreModel); | ||
var Store = _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.transformStore(this.storeTransforms, StoreModel); | ||
_utilsStoreUtils.createStoreConfig(this.config, StoreModel); | ||
var Store = _utilsStoreUtils.transformStore(this.storeTransforms, StoreModel); | ||
return typeof Store === 'object' ? _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromObject(this, Store, key) : _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
return typeof Store === 'object' ? _utilsStoreUtils.createStoreFromObject(this, Store, key) : _utilsStoreUtils.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
} | ||
@@ -1576,19 +1585,19 @@ }, { | ||
var key = iden || StoreModel.displayName || StoreModel.name || ''; | ||
_createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreConfig(this.config, StoreModel); | ||
var Store = _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.transformStore(this.storeTransforms, StoreModel); | ||
_utilsStoreUtils.createStoreConfig(this.config, StoreModel); | ||
var Store = _utilsStoreUtils.transformStore(this.storeTransforms, StoreModel); | ||
if (this.stores[key] || !key) { | ||
if (this.stores[key]) { | ||
_dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.warn('A store named ' + key + ' already exists, double check your store ' + 'names or pass in your own custom identifier for each store'); | ||
_utilsAltUtils.warn('A store named ' + key + ' already exists, double check your store ' + 'names or pass in your own custom identifier for each store'); | ||
} else { | ||
_dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.warn('Store name was not specified'); | ||
_utilsAltUtils.warn('Store name was not specified'); | ||
} | ||
key = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.uid(this.stores, key); | ||
key = _utilsAltUtils.uid(this.stores, key); | ||
} | ||
var storeInstance = typeof Store === 'object' ? _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromObject(this, Store, key) : _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
var storeInstance = typeof Store === 'object' ? _utilsStoreUtils.createStoreFromObject(this, Store, key) : _utilsStoreUtils.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
this.stores[key] = storeInstance; | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.saveInitialSnapshot(this, key); | ||
_utilsStateFunctions.saveInitialSnapshot(this, key); | ||
@@ -1606,3 +1615,3 @@ return storeInstance; | ||
return this.createActions(actionNames.reduce(function (obj, action) { | ||
obj[action] = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.dispatchIdentity; | ||
obj[action] = _utilsAltUtils.dispatchIdentity; | ||
return obj; | ||
@@ -1614,3 +1623,3 @@ }, actions)); | ||
value: function createAction(name, implementation, obj) { | ||
return _makeAction2['default'](this, 'global', name, implementation, obj); | ||
return _utilsMakeAction2['default'](this, 'global', name, implementation, obj); | ||
} | ||
@@ -1620,3 +1629,3 @@ }, { | ||
value: function createActions(ActionsClass) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -1630,7 +1639,7 @@ for (var _len4 = arguments.length, argsForConstructor = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
var actions = {}; | ||
var key = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.uid(this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTIONS_REGISTRY], ActionsClass.displayName || ActionsClass.name || 'Unknown'); | ||
var key = _utilsAltUtils.uid(this[_symbolsSymbols.ACTIONS_REGISTRY], ActionsClass.displayName || ActionsClass.name || 'Unknown'); | ||
if (typeof ActionsClass === 'function') { | ||
(function () { | ||
_assign2['default'](actions, _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.getInternalMethods(ActionsClass.prototype, true)); | ||
_objectAssign2['default'](actions, _utilsAltUtils.getInternalMethods(ActionsClass.prototype, true)); | ||
@@ -1658,3 +1667,3 @@ var ActionsGenerator = (function (_ActionsClass) { | ||
actionNames.forEach(function (actionName) { | ||
actions[actionName] = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.dispatchIdentity; | ||
actions[actionName] = _utilsAltUtils.dispatchIdentity; | ||
}); | ||
@@ -1667,6 +1676,6 @@ } | ||
_assign2['default'](actions, new (_bind.apply(ActionsGenerator, [null].concat(argsForConstructor)))()); | ||
_objectAssign2['default'](actions, new (_bind.apply(ActionsGenerator, [null].concat(argsForConstructor)))()); | ||
})(); | ||
} else { | ||
_assign2['default'](actions, ActionsClass); | ||
_objectAssign2['default'](actions, ActionsClass); | ||
} | ||
@@ -1682,7 +1691,7 @@ | ||
// create the action | ||
obj[action] = _makeAction2['default'](_this, key, action, actions[action], obj); | ||
obj[action] = _utilsMakeAction2['default'](_this2, key, action, actions[action], obj); | ||
// generate a constant | ||
var constant = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.formatAsConstant(action); | ||
obj[constant] = obj[action][_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTION_KEY]; | ||
var constant = _utilsAltUtils.formatAsConstant(action); | ||
obj[constant] = obj[action][_symbolsSymbols.ACTION_KEY]; | ||
@@ -1699,4 +1708,4 @@ return obj; | ||
var state = _filterSnapshots$saveInitialSnapshot$setAppState$snapshot.snapshot(this, storeNames); | ||
_assign2['default'](this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT], state); | ||
var state = _utilsStateFunctions.snapshot(this, storeNames); | ||
_objectAssign2['default'](this[_symbolsSymbols.LAST_SNAPSHOT], state); | ||
return this.serialize(state); | ||
@@ -1707,5 +1716,5 @@ } | ||
value: function rollback() { | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, this.serialize(this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT]), function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].rollback) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].rollback(); | ||
_utilsStateFunctions.setAppState(this, this.serialize(this[_symbolsSymbols.LAST_SNAPSHOT]), function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].rollback) { | ||
store[_symbolsSymbols.LIFECYCLE].rollback(); | ||
} | ||
@@ -1722,7 +1731,7 @@ store.emitChange(); | ||
var initialSnapshot = storeNames.length ? _filterSnapshots$saveInitialSnapshot$setAppState$snapshot.filterSnapshots(this, this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT], storeNames) : this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT]; | ||
var initialSnapshot = storeNames.length ? _utilsStateFunctions.filterSnapshots(this, this[_symbolsSymbols.INIT_SNAPSHOT], storeNames) : this[_symbolsSymbols.INIT_SNAPSHOT]; | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, this.serialize(initialSnapshot), function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].init) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].init(); | ||
_utilsStateFunctions.setAppState(this, this.serialize(initialSnapshot), function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].init) { | ||
store[_symbolsSymbols.LIFECYCLE].init(); | ||
} | ||
@@ -1735,3 +1744,3 @@ store.emitChange(); | ||
value: function flush() { | ||
var state = this.serialize(_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.snapshot(this)); | ||
var state = this.serialize(_utilsStateFunctions.snapshot(this)); | ||
this.recycle(); | ||
@@ -1743,5 +1752,5 @@ return state; | ||
value: function bootstrap(data) { | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, data, function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].bootstrap) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].bootstrap(); | ||
_utilsStateFunctions.setAppState(this, data, function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].bootstrap) { | ||
store[_symbolsSymbols.LIFECYCLE].bootstrap(); | ||
} | ||
@@ -1748,0 +1757,0 @@ store.emitChange(); |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -9,55 +7,57 @@ value: true | ||
var _Alt = require('./'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Alt2 = _interopRequireWildcard(_Alt); | ||
var _ = require('./'); | ||
var _ActionListeners = require('../utils/ActionListeners'); | ||
var _2 = _interopRequireDefault(_); | ||
var _ActionListeners2 = _interopRequireWildcard(_ActionListeners); | ||
var _utilsActionListeners = require('../utils/ActionListeners'); | ||
var _AltManager = require('../utils/AltManager'); | ||
var _utilsActionListeners2 = _interopRequireDefault(_utilsActionListeners); | ||
var _AltManager2 = _interopRequireWildcard(_AltManager); | ||
var _utilsAltManager = require('../utils/AltManager'); | ||
var _DispatcherRecorder = require('../utils/DispatcherRecorder'); | ||
var _utilsAltManager2 = _interopRequireDefault(_utilsAltManager); | ||
var _DispatcherRecorder2 = _interopRequireWildcard(_DispatcherRecorder); | ||
var _utilsDispatcherRecorder = require('../utils/DispatcherRecorder'); | ||
var _atomic = require('../utils/atomic'); | ||
var _utilsDispatcherRecorder2 = _interopRequireDefault(_utilsDispatcherRecorder); | ||
var _atomic2 = _interopRequireWildcard(_atomic); | ||
var _utilsAtomic = require('../utils/atomic'); | ||
var _connectToStores = require('../utils/connectToStores'); | ||
var _utilsAtomic2 = _interopRequireDefault(_utilsAtomic); | ||
var _connectToStores2 = _interopRequireWildcard(_connectToStores); | ||
var _utilsConnectToStores = require('../utils/connectToStores'); | ||
var _chromeDebug = require('../utils/chromeDebug'); | ||
var _utilsConnectToStores2 = _interopRequireDefault(_utilsConnectToStores); | ||
var _chromeDebug2 = _interopRequireWildcard(_chromeDebug); | ||
var _utilsChromeDebug = require('../utils/chromeDebug'); | ||
var _makeFinalStore = require('../utils/makeFinalStore'); | ||
var _utilsChromeDebug2 = _interopRequireDefault(_utilsChromeDebug); | ||
var _makeFinalStore2 = _interopRequireWildcard(_makeFinalStore); | ||
var _utilsMakeFinalStore = require('../utils/makeFinalStore'); | ||
var _withAltContext = require('../utils/withAltContext'); | ||
var _utilsMakeFinalStore2 = _interopRequireDefault(_utilsMakeFinalStore); | ||
var _withAltContext2 = _interopRequireWildcard(_withAltContext); | ||
var _utilsWithAltContext = require('../utils/withAltContext'); | ||
var _utilsWithAltContext2 = _interopRequireDefault(_utilsWithAltContext); | ||
var _AltContainer = require('../../AltContainer'); | ||
var _AltContainer2 = _interopRequireWildcard(_AltContainer); | ||
var _AltContainer2 = _interopRequireDefault(_AltContainer); | ||
_Alt2['default'].addons = { | ||
ActionListeners: _ActionListeners2['default'], | ||
_2['default'].addons = { | ||
ActionListeners: _utilsActionListeners2['default'], | ||
AltContainer: _AltContainer2['default'], | ||
AltManager: _AltManager2['default'], | ||
DispatcherRecorder: _DispatcherRecorder2['default'], | ||
atomic: _atomic2['default'], | ||
chromeDebug: _chromeDebug2['default'], | ||
connectToStores: _connectToStores2['default'], | ||
makeFinalStore: _makeFinalStore2['default'], | ||
withAltContext: _withAltContext2['default'] | ||
AltManager: _utilsAltManager2['default'], | ||
DispatcherRecorder: _utilsDispatcherRecorder2['default'], | ||
atomic: _utilsAtomic2['default'], | ||
chromeDebug: _utilsChromeDebug2['default'], | ||
connectToStores: _utilsConnectToStores2['default'], | ||
makeFinalStore: _utilsMakeFinalStore2['default'], | ||
withAltContext: _utilsWithAltContext2['default'] | ||
}; | ||
exports['default'] = _Alt2['default']; | ||
exports['default'] = _2['default']; | ||
module.exports = exports['default']; |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -13,6 +7,12 @@ value: true | ||
var _import = require('./symbols/symbols'); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var Sym = _interopRequireWildcard(_import); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var ACTION_HANDLER = Sym.ACTION_HANDLER; | ||
@@ -19,0 +19,0 @@ var ACTION_UID = Sym.ACTION_UID; |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -13,18 +7,26 @@ value: true | ||
var _EventEmitter = require('eventemitter3'); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _EventEmitter2 = _interopRequireWildcard(_EventEmitter); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _assign = require('object-assign'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _Symbol = require('es-symbol'); | ||
var _eventemitter3 = require('eventemitter3'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _eventemitter32 = _interopRequireDefault(_eventemitter3); | ||
var _import = require('./symbols/symbols'); | ||
var _objectAssign = require('object-assign'); | ||
var Sym = _interopRequireWildcard(_import); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var ALL_LISTENERS = Sym.ALL_LISTENERS; | ||
@@ -37,3 +39,3 @@ var LIFECYCLE = Sym.LIFECYCLE; | ||
// event emitter instance | ||
var EE = _Symbol2['default'](); | ||
var EE = _esSymbol2['default'](); | ||
@@ -46,3 +48,3 @@ var AltStore = (function () { | ||
this[EE] = new _EventEmitter2['default'](); | ||
this[EE] = new _eventemitter32['default'](); | ||
this[LIFECYCLE] = {}; | ||
@@ -55,7 +57,7 @@ this[STATE_CONTAINER] = state || model; | ||
if (typeof this.StoreModel === 'object') { | ||
this.StoreModel.state = _assign2['default']({}, StoreModel.state); | ||
this.StoreModel.state = _objectAssign2['default']({}, StoreModel.state); | ||
} | ||
_assign2['default'](this[LIFECYCLE], model[LIFECYCLE]); | ||
_assign2['default'](this, model[PUBLIC_METHODS]); | ||
_objectAssign2['default'](this[LIFECYCLE], model[LIFECYCLE]); | ||
_objectAssign2['default'](this, model[PUBLIC_METHODS]); | ||
@@ -62,0 +64,0 @@ // Register dispatcher |
113
lib/index.js
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _bind = Function.prototype.bind; | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _get = function get(_x3, _x4, _x5) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x3, | ||
property = _x4, | ||
receiver = _x5; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x3 = parent; _x4 = property; _x5 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _assign = require('object-assign'); | ||
var _objectAssign = require('object-assign'); | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _Dispatcher = require('flux'); | ||
var _flux = require('flux'); | ||
var _makeAction = require('./utils/makeAction'); | ||
var _utilsMakeAction = require('./utils/makeAction'); | ||
var _makeAction2 = _interopRequireWildcard(_makeAction); | ||
var _utilsMakeAction2 = _interopRequireDefault(_utilsMakeAction); | ||
var _filterSnapshots$saveInitialSnapshot$setAppState$snapshot = require('./utils/StateFunctions'); | ||
var _utilsStateFunctions = require('./utils/StateFunctions'); | ||
var _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore = require('./utils/StoreUtils'); | ||
var _utilsStoreUtils = require('./utils/StoreUtils'); | ||
var _ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE = require('./symbols/symbols'); | ||
var _symbolsSymbols = require('./symbols/symbols'); | ||
var _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn = require('./utils/AltUtils'); | ||
var _utilsAltUtils = require('./utils/AltUtils'); | ||
@@ -46,9 +47,9 @@ var Alt = (function () { | ||
this.deserialize = config.deserialize || JSON.parse; | ||
this.dispatcher = config.dispatcher || new _Dispatcher.Dispatcher(); | ||
this.dispatcher = config.dispatcher || new _flux.Dispatcher(); | ||
this.actions = { global: {} }; | ||
this.stores = {}; | ||
this.storeTransforms = config.storeTransforms || []; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTIONS_REGISTRY] = {}; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT] = {}; | ||
this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT] = {}; | ||
this[_symbolsSymbols.ACTIONS_REGISTRY] = {}; | ||
this[_symbolsSymbols.INIT_SNAPSHOT] = {}; | ||
this[_symbolsSymbols.LAST_SNAPSHOT] = {}; | ||
} | ||
@@ -69,6 +70,6 @@ | ||
var key = StoreModel.displayName || ''; | ||
_createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreConfig(this.config, StoreModel); | ||
var Store = _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.transformStore(this.storeTransforms, StoreModel); | ||
_utilsStoreUtils.createStoreConfig(this.config, StoreModel); | ||
var Store = _utilsStoreUtils.transformStore(this.storeTransforms, StoreModel); | ||
return typeof Store === 'object' ? _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromObject(this, Store, key) : _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
return typeof Store === 'object' ? _utilsStoreUtils.createStoreFromObject(this, Store, key) : _utilsStoreUtils.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
} | ||
@@ -83,19 +84,19 @@ }, { | ||
var key = iden || StoreModel.displayName || StoreModel.name || ''; | ||
_createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreConfig(this.config, StoreModel); | ||
var Store = _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.transformStore(this.storeTransforms, StoreModel); | ||
_utilsStoreUtils.createStoreConfig(this.config, StoreModel); | ||
var Store = _utilsStoreUtils.transformStore(this.storeTransforms, StoreModel); | ||
if (this.stores[key] || !key) { | ||
if (this.stores[key]) { | ||
_dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.warn('A store named ' + key + ' already exists, double check your store ' + 'names or pass in your own custom identifier for each store'); | ||
_utilsAltUtils.warn('A store named ' + key + ' already exists, double check your store ' + 'names or pass in your own custom identifier for each store'); | ||
} else { | ||
_dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.warn('Store name was not specified'); | ||
_utilsAltUtils.warn('Store name was not specified'); | ||
} | ||
key = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.uid(this.stores, key); | ||
key = _utilsAltUtils.uid(this.stores, key); | ||
} | ||
var storeInstance = typeof Store === 'object' ? _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromObject(this, Store, key) : _createStoreConfig$createStoreFromObject$createStoreFromClass$transformStore.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
var storeInstance = typeof Store === 'object' ? _utilsStoreUtils.createStoreFromObject(this, Store, key) : _utilsStoreUtils.createStoreFromClass.apply(undefined, [this, Store, key].concat(args)); | ||
this.stores[key] = storeInstance; | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.saveInitialSnapshot(this, key); | ||
_utilsStateFunctions.saveInitialSnapshot(this, key); | ||
@@ -113,3 +114,3 @@ return storeInstance; | ||
return this.createActions(actionNames.reduce(function (obj, action) { | ||
obj[action] = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.dispatchIdentity; | ||
obj[action] = _utilsAltUtils.dispatchIdentity; | ||
return obj; | ||
@@ -121,3 +122,3 @@ }, actions)); | ||
value: function createAction(name, implementation, obj) { | ||
return _makeAction2['default'](this, 'global', name, implementation, obj); | ||
return _utilsMakeAction2['default'](this, 'global', name, implementation, obj); | ||
} | ||
@@ -127,3 +128,3 @@ }, { | ||
value: function createActions(ActionsClass) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -137,7 +138,7 @@ for (var _len4 = arguments.length, argsForConstructor = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { | ||
var actions = {}; | ||
var key = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.uid(this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTIONS_REGISTRY], ActionsClass.displayName || ActionsClass.name || 'Unknown'); | ||
var key = _utilsAltUtils.uid(this[_symbolsSymbols.ACTIONS_REGISTRY], ActionsClass.displayName || ActionsClass.name || 'Unknown'); | ||
if (typeof ActionsClass === 'function') { | ||
(function () { | ||
_assign2['default'](actions, _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.getInternalMethods(ActionsClass.prototype, true)); | ||
_objectAssign2['default'](actions, _utilsAltUtils.getInternalMethods(ActionsClass.prototype, true)); | ||
@@ -165,3 +166,3 @@ var ActionsGenerator = (function (_ActionsClass) { | ||
actionNames.forEach(function (actionName) { | ||
actions[actionName] = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.dispatchIdentity; | ||
actions[actionName] = _utilsAltUtils.dispatchIdentity; | ||
}); | ||
@@ -174,6 +175,6 @@ } | ||
_assign2['default'](actions, new (_bind.apply(ActionsGenerator, [null].concat(argsForConstructor)))()); | ||
_objectAssign2['default'](actions, new (_bind.apply(ActionsGenerator, [null].concat(argsForConstructor)))()); | ||
})(); | ||
} else { | ||
_assign2['default'](actions, ActionsClass); | ||
_objectAssign2['default'](actions, ActionsClass); | ||
} | ||
@@ -189,7 +190,7 @@ | ||
// create the action | ||
obj[action] = _makeAction2['default'](_this, key, action, actions[action], obj); | ||
obj[action] = _utilsMakeAction2['default'](_this2, key, action, actions[action], obj); | ||
// generate a constant | ||
var constant = _dispatchIdentity$formatAsConstant$getInternalMethods$uid$warn.formatAsConstant(action); | ||
obj[constant] = obj[action][_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.ACTION_KEY]; | ||
var constant = _utilsAltUtils.formatAsConstant(action); | ||
obj[constant] = obj[action][_symbolsSymbols.ACTION_KEY]; | ||
@@ -206,4 +207,4 @@ return obj; | ||
var state = _filterSnapshots$saveInitialSnapshot$setAppState$snapshot.snapshot(this, storeNames); | ||
_assign2['default'](this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT], state); | ||
var state = _utilsStateFunctions.snapshot(this, storeNames); | ||
_objectAssign2['default'](this[_symbolsSymbols.LAST_SNAPSHOT], state); | ||
return this.serialize(state); | ||
@@ -214,5 +215,5 @@ } | ||
value: function rollback() { | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, this.serialize(this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LAST_SNAPSHOT]), function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].rollback) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].rollback(); | ||
_utilsStateFunctions.setAppState(this, this.serialize(this[_symbolsSymbols.LAST_SNAPSHOT]), function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].rollback) { | ||
store[_symbolsSymbols.LIFECYCLE].rollback(); | ||
} | ||
@@ -229,7 +230,7 @@ store.emitChange(); | ||
var initialSnapshot = storeNames.length ? _filterSnapshots$saveInitialSnapshot$setAppState$snapshot.filterSnapshots(this, this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT], storeNames) : this[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.INIT_SNAPSHOT]; | ||
var initialSnapshot = storeNames.length ? _utilsStateFunctions.filterSnapshots(this, this[_symbolsSymbols.INIT_SNAPSHOT], storeNames) : this[_symbolsSymbols.INIT_SNAPSHOT]; | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, this.serialize(initialSnapshot), function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].init) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].init(); | ||
_utilsStateFunctions.setAppState(this, this.serialize(initialSnapshot), function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].init) { | ||
store[_symbolsSymbols.LIFECYCLE].init(); | ||
} | ||
@@ -242,3 +243,3 @@ store.emitChange(); | ||
value: function flush() { | ||
var state = this.serialize(_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.snapshot(this)); | ||
var state = this.serialize(_utilsStateFunctions.snapshot(this)); | ||
this.recycle(); | ||
@@ -250,5 +251,5 @@ return state; | ||
value: function bootstrap(data) { | ||
_filterSnapshots$saveInitialSnapshot$setAppState$snapshot.setAppState(this, data, function (store) { | ||
if (store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].bootstrap) { | ||
store[_ACTION_KEY$ACTIONS_REGISTRY$INIT_SNAPSHOT$LAST_SNAPSHOT$LIFECYCLE.LIFECYCLE].bootstrap(); | ||
_utilsStateFunctions.setAppState(this, data, function (store) { | ||
if (store[_symbolsSymbols.LIFECYCLE].bootstrap) { | ||
store[_symbolsSymbols.LIFECYCLE].bootstrap(); | ||
} | ||
@@ -255,0 +256,0 @@ store.emitChange(); |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -9,48 +7,50 @@ value: true | ||
var _Symbol = require('es-symbol'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
// action creator handler | ||
var ACTION_HANDLER = _Symbol2['default'](); | ||
var ACTION_HANDLER = _esSymbol2['default'](); | ||
exports.ACTION_HANDLER = ACTION_HANDLER; | ||
// the action's uid symbol for listening | ||
var ACTION_KEY = _Symbol2['default'](); | ||
var ACTION_KEY = _esSymbol2['default'](); | ||
exports.ACTION_KEY = ACTION_KEY; | ||
// per instance registry of actions | ||
var ACTIONS_REGISTRY = _Symbol2['default'](); | ||
var ACTIONS_REGISTRY = _esSymbol2['default'](); | ||
exports.ACTIONS_REGISTRY = ACTIONS_REGISTRY; | ||
// the action's name | ||
var ACTION_UID = _Symbol2['default'](); | ||
var ACTION_UID = _esSymbol2['default'](); | ||
exports.ACTION_UID = ACTION_UID; | ||
// store all of a store's listeners | ||
var ALL_LISTENERS = _Symbol2['default'](); | ||
var ALL_LISTENERS = _esSymbol2['default'](); | ||
exports.ALL_LISTENERS = ALL_LISTENERS; | ||
// initial snapshot | ||
var INIT_SNAPSHOT = _Symbol2['default'](); | ||
var INIT_SNAPSHOT = _esSymbol2['default'](); | ||
exports.INIT_SNAPSHOT = INIT_SNAPSHOT; | ||
// last snapshot | ||
var LAST_SNAPSHOT = _Symbol2['default'](); | ||
var LAST_SNAPSHOT = _esSymbol2['default'](); | ||
exports.LAST_SNAPSHOT = LAST_SNAPSHOT; | ||
// all lifecycle listeners | ||
var LIFECYCLE = _Symbol2['default'](); | ||
var LIFECYCLE = _esSymbol2['default'](); | ||
exports.LIFECYCLE = LIFECYCLE; | ||
// store action listeners | ||
var LISTENERS = _Symbol2['default'](); | ||
var LISTENERS = _esSymbol2['default'](); | ||
exports.LISTENERS = LISTENERS; | ||
// public methods | ||
var PUBLIC_METHODS = _Symbol2['default'](); | ||
var PUBLIC_METHODS = _esSymbol2['default'](); | ||
exports.PUBLIC_METHODS = PUBLIC_METHODS; | ||
// contains all state | ||
var STATE_CONTAINER = _Symbol2['default'](); | ||
var STATE_CONTAINER = _esSymbol2['default'](); | ||
exports.STATE_CONTAINER = STATE_CONTAINER; |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -10,15 +8,19 @@ value: true | ||
var _import = require('../symbols/symbols'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var Sym = _interopRequireWildcard(_import); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _Symbol = require('es-symbol'); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var _esSymbol = require('es-symbol'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _AltAction = require('../AltAction'); | ||
var _AltAction2 = _interopRequireWildcard(_AltAction); | ||
var _AltAction2 = _interopRequireDefault(_AltAction); | ||
var _uid = require('./AltUtils'); | ||
var _AltUtils = require('./AltUtils'); | ||
@@ -31,5 +33,5 @@ var ACTION_KEY = Sym.ACTION_KEY; | ||
// make sure each Symbol is unique | ||
var actionId = _uid.uid(alt[ACTIONS_REGISTRY], '' + namespace + '.' + name); | ||
var actionId = _AltUtils.uid(alt[ACTIONS_REGISTRY], '' + namespace + '.' + name); | ||
alt[ACTIONS_REGISTRY][actionId] = 1; | ||
var actionSymbol = _Symbol2['default']['for']('alt/' + actionId); | ||
var actionSymbol = _esSymbol2['default']['for']('alt/' + actionId); | ||
@@ -62,3 +64,3 @@ var data = { | ||
var container = alt.actions[namespace]; | ||
var id = _uid.uid(container, name); | ||
var id = _AltUtils.uid(container, name); | ||
container[id] = action; | ||
@@ -65,0 +67,0 @@ |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -13,10 +11,14 @@ value: true | ||
var _assign = require('object-assign'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _import = require('../symbols/symbols'); | ||
var _objectAssign = require('object-assign'); | ||
var Sym = _interopRequireWildcard(_import); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var Sym = _interopRequireWildcard(_symbolsSymbols); | ||
var INIT_SNAPSHOT = Sym.INIT_SNAPSHOT; | ||
@@ -37,3 +39,3 @@ var LAST_SNAPSHOT = Sym.LAST_SNAPSHOT; | ||
} | ||
_assign2['default'](store[STATE_CONTAINER], obj[key]); | ||
_objectAssign2['default'](store[STATE_CONTAINER], obj[key]); | ||
onStore(store); | ||
@@ -40,0 +42,0 @@ } |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -9,8 +7,10 @@ value: true | ||
var _Symbol = require('es-symbol'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol = require('es-symbol'); | ||
var _ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS = require('../symbols/symbols'); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
var StoreMixinEssentials = { | ||
@@ -44,3 +44,3 @@ waitFor: function waitFor(sources) { | ||
_this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.PUBLIC_METHODS][methodName] = methods[methodName]; | ||
_this[_symbolsSymbols.PUBLIC_METHODS][methodName] = methods[methodName]; | ||
}); | ||
@@ -57,3 +57,3 @@ }, | ||
on: function on(lifecycleEvent, handler) { | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.LIFECYCLE][lifecycleEvent] = handler.bind(this); | ||
this[_symbolsSymbols.LIFECYCLE][lifecycleEvent] = handler.bind(this); | ||
}, | ||
@@ -70,9 +70,9 @@ | ||
if (handler.length > 1) { | ||
throw new TypeError('Action handler in store ' + this._storeName + ' for ' + ('' + (symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] || symbol).toString() + ' was defined with 2 ') + 'parameters. Only a single parameter is passed through the ' + 'dispatcher, did you mean to pass in an Object instead?'); | ||
throw new TypeError('Action handler in store ' + this._storeName + ' for ' + ('' + (symbol[_symbolsSymbols.ACTION_KEY] || symbol).toString() + ' was defined with 2 ') + 'parameters. Only a single parameter is passed through the ' + 'dispatcher, did you mean to pass in an Object instead?'); | ||
} | ||
// You can pass in the constant or the function itself | ||
var key = symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] ? symbol[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ACTION_KEY] : symbol; | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.LISTENERS][key] = handler.bind(this); | ||
this[_ACTION_KEY$ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS.ALL_LISTENERS].push(_Symbol2['default'].keyFor(key)); | ||
var key = symbol[_symbolsSymbols.ACTION_KEY] ? symbol[_symbolsSymbols.ACTION_KEY] : symbol; | ||
this[_symbolsSymbols.LISTENERS][key] = handler.bind(this); | ||
this[_symbolsSymbols.ALL_LISTENERS].push(_esSymbol2['default'].keyFor(key)); | ||
}, | ||
@@ -79,0 +79,0 @@ |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _bind = Function.prototype.bind; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x, | ||
property = _x2, | ||
receiver = _x3; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports.createStoreConfig = createStoreConfig; | ||
@@ -21,15 +17,21 @@ exports.transformStore = transformStore; | ||
var _assign = require('object-assign'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var _objectAssign = require('object-assign'); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _AltStore = require('../AltStore'); | ||
var _AltStore2 = _interopRequireWildcard(_AltStore); | ||
var _AltStore2 = _interopRequireDefault(_AltStore); | ||
var _getInternalMethods = require('./AltUtils'); | ||
var _AltUtils = require('./AltUtils'); | ||
var _StoreMixinEssentials$StoreMixinListeners = require('./StoreMixins'); | ||
var _StoreMixins = require('./StoreMixins'); | ||
var _ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER = require('../symbols/symbols'); | ||
var _symbolsSymbols = require('../symbols/symbols'); | ||
@@ -43,5 +45,5 @@ function doSetState(store, storeInstance, state) { | ||
var nextState = typeof state === 'function' ? state(storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER]) : state; | ||
var nextState = typeof state === 'function' ? state(storeInstance[_symbolsSymbols.STATE_CONTAINER]) : state; | ||
storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER] = config.setState.call(store, storeInstance[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.STATE_CONTAINER], nextState); | ||
storeInstance[_symbolsSymbols.STATE_CONTAINER] = config.setState.call(store, storeInstance[_symbolsSymbols.STATE_CONTAINER], nextState); | ||
@@ -54,3 +56,3 @@ if (!store.alt.dispatcher.isDispatching()) { | ||
function createStoreConfig(globalConfig, StoreModel) { | ||
StoreModel.config = _assign2['default']({ | ||
StoreModel.config = _objectAssign2['default']({ | ||
getState: function getState(state) { | ||
@@ -62,3 +64,3 @@ return Object.keys(state).reduce(function (obj, key) { | ||
}, | ||
setState: _assign2['default'] | ||
setState: _objectAssign2['default'] | ||
}, globalConfig, StoreModel.config); | ||
@@ -77,7 +79,7 @@ } | ||
var StoreProto = {}; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.ALL_LISTENERS] = []; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LIFECYCLE] = {}; | ||
StoreProto[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LISTENERS] = {}; | ||
StoreProto[_symbolsSymbols.ALL_LISTENERS] = []; | ||
StoreProto[_symbolsSymbols.LIFECYCLE] = {}; | ||
StoreProto[_symbolsSymbols.LISTENERS] = {}; | ||
_assign2['default'](StoreProto, { | ||
_objectAssign2['default'](StoreProto, { | ||
_storeName: key, | ||
@@ -92,3 +94,3 @@ alt: alt, | ||
} | ||
}, _StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners, _StoreMixinEssentials$StoreMixinListeners.StoreMixinEssentials, StoreModel); | ||
}, _StoreMixins.StoreMixinListeners, _StoreMixins.StoreMixinEssentials, StoreModel); | ||
@@ -98,3 +100,3 @@ // bind the store listeners | ||
if (StoreProto.bindListeners) { | ||
_StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners.bindListeners.call(StoreProto, StoreProto.bindListeners); | ||
_StoreMixins.StoreMixinListeners.bindListeners.call(StoreProto, StoreProto.bindListeners); | ||
} | ||
@@ -106,3 +108,3 @@ | ||
Object.keys(StoreProto.lifecycle).forEach(function (event) { | ||
_StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners.on.call(StoreProto, event, StoreProto.lifecycle[event]); | ||
_StoreMixins.StoreMixinListeners.on.call(StoreProto, event, StoreProto.lifecycle[event]); | ||
}); | ||
@@ -112,3 +114,3 @@ } | ||
// create the instance and assign the public methods to the instance | ||
storeInstance = _assign2['default'](new _AltStore2['default'](alt, StoreProto, StoreProto.state, StoreModel), StoreProto.publicMethods, { displayName: key }); | ||
storeInstance = _objectAssign2['default'](new _AltStore2['default'](alt, StoreProto, StoreProto.state, StoreModel), StoreProto.publicMethods, { displayName: key }); | ||
@@ -146,3 +148,3 @@ return storeInstance; | ||
_assign2['default'](Store.prototype, _StoreMixinEssentials$StoreMixinListeners.StoreMixinListeners, _StoreMixinEssentials$StoreMixinListeners.StoreMixinEssentials, { | ||
_objectAssign2['default'](Store.prototype, _StoreMixins.StoreMixinListeners, _StoreMixins.StoreMixinEssentials, { | ||
_storeName: key, | ||
@@ -159,12 +161,12 @@ alt: alt, | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.ALL_LISTENERS] = []; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LIFECYCLE] = {}; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.LISTENERS] = {}; | ||
Store.prototype[_ALL_LISTENERS$LIFECYCLE$LISTENERS$PUBLIC_METHODS$STATE_CONTAINER.PUBLIC_METHODS] = {}; | ||
Store.prototype[_symbolsSymbols.ALL_LISTENERS] = []; | ||
Store.prototype[_symbolsSymbols.LIFECYCLE] = {}; | ||
Store.prototype[_symbolsSymbols.LISTENERS] = {}; | ||
Store.prototype[_symbolsSymbols.PUBLIC_METHODS] = {}; | ||
var store = new (_bind.apply(Store, [null].concat(argsForClass)))(); | ||
storeInstance = _assign2['default'](new _AltStore2['default'](alt, store, store[alt.config.stateKey] || store[config.stateKey] || null, StoreModel), _getInternalMethods.getInternalMethods(StoreModel), { displayName: key }); | ||
storeInstance = _objectAssign2['default'](new _AltStore2['default'](alt, store, store[alt.config.stateKey] || store[config.stateKey] || null, StoreModel), _AltUtils.getInternalMethods(StoreModel), { displayName: key }); | ||
return storeInstance; | ||
} |
{ | ||
"name": "alt", | ||
"version": "0.16.2", | ||
"version": "0.16.3", | ||
"description": "A flux implementation", | ||
"main": "lib", | ||
"dependencies": { | ||
"es-symbol": "^1.1.1", | ||
"es-symbol": "1.1.2", | ||
"eventemitter3": "^0.1.6", | ||
@@ -9,0 +9,0 @@ "flux": "^2.0.1", |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
/** | ||
@@ -27,7 +28,7 @@ * ActionListeners(alt: AltInstance): ActionListenersInstance | ||
var _Symbol = require('es-symbol'); | ||
var _esSymbol = require('es-symbol'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
var ALT_LISTENERS = _Symbol2['default']('global dispatcher listeners'); | ||
var ALT_LISTENERS = _esSymbol2['default']('global dispatcher listeners'); | ||
@@ -34,0 +35,0 @@ function ActionListeners(alt) { |
'use strict'; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
/** | ||
@@ -11,0 +12,0 @@ * AltManager(Alt: AltClass): undefined |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x2, | ||
property = _x3, | ||
receiver = _x4; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var _assign = require('object-assign'); | ||
var _objectAssign = require('object-assign'); | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
@@ -50,3 +52,3 @@ var noop = function noop() {}; | ||
_assign2['default'](DerivedStore.prototype, StorePrototype); | ||
_objectAssign2['default'](DerivedStore.prototype, StorePrototype); | ||
return new DerivedStore(); | ||
@@ -53,0 +55,0 @@ }, |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x, | ||
property = _x2, | ||
receiver = _x3; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
exports['default'] = atomic; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var _makeFinalStore = require('./makeFinalStore'); | ||
var _makeFinalStore2 = _interopRequireWildcard(_makeFinalStore); | ||
var _makeFinalStore2 = _interopRequireDefault(_makeFinalStore); | ||
@@ -20,0 +23,0 @@ function makeAtomicClass(alt, StoreModel) { |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
/** | ||
@@ -53,9 +54,9 @@ * 'Higher Order Component' that controls the props of a wrapped | ||
var _React = require('react'); | ||
var _react = require('react'); | ||
var _React2 = _interopRequireWildcard(_React); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _assign = require('object-assign'); | ||
var _objectAssign = require('object-assign'); | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
@@ -75,3 +76,3 @@ function connectToStores(Component) { | ||
// Wrapper Component. | ||
var StoreConnection = _React2['default'].createClass({ | ||
var StoreConnection = _react2['default'].createClass({ | ||
displayName: 'StoreConnection', | ||
@@ -104,3 +105,3 @@ | ||
render: function render() { | ||
return _React2['default'].createElement(Component, _assign2['default']({}, this.props, this.state)); | ||
return _react2['default'].createElement(Component, _objectAssign2['default']({}, this.props, this.state)); | ||
} | ||
@@ -107,0 +108,0 @@ }); |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
/** | ||
@@ -36,5 +37,5 @@ * DispatcherRecorder(alt: AltInstance): DispatcherInstance | ||
var _Symbol = require('es-symbol'); | ||
var _esSymbol = require('es-symbol'); | ||
var _Symbol2 = _interopRequireWildcard(_Symbol); | ||
var _esSymbol2 = _interopRequireDefault(_esSymbol); | ||
@@ -129,3 +130,3 @@ function DispatcherRecorder(alt) { | ||
return { | ||
action: _Symbol2['default'].keyFor(event.action), | ||
action: _esSymbol2['default'].keyFor(event.action), | ||
data: event.data | ||
@@ -145,3 +146,3 @@ }; | ||
return { | ||
action: _Symbol2['default']['for'](event.action), | ||
action: _esSymbol2['default']['for'](event.action), | ||
data: event.data | ||
@@ -148,0 +149,0 @@ }; |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -9,6 +7,8 @@ value: true | ||
var _Immutable = require('immutable'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _Immutable2 = _interopRequireWildcard(_Immutable); | ||
var _immutable = require('immutable'); | ||
var _immutable2 = _interopRequireDefault(_immutable); | ||
function immutable(StoreModel) { | ||
@@ -32,3 +32,3 @@ StoreModel.config = { | ||
onDeserialize: function onDeserialize(data) { | ||
return _Immutable2['default'].fromJS(data); | ||
return _immutable2['default'].fromJS(data); | ||
} | ||
@@ -35,0 +35,0 @@ }; |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -9,2 +7,5 @@ value: true | ||
exports['default'] = IsomorphicRenderer; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
/** | ||
@@ -37,9 +38,9 @@ * IsomorphicRenderer(alt: AltInstance, App: ReactElement): mixed | ||
var _Iso = require('iso'); | ||
var _iso = require('iso'); | ||
var _Iso2 = _interopRequireWildcard(_Iso); | ||
var _iso2 = _interopRequireDefault(_iso); | ||
var _React = require('react'); | ||
var _react = require('react'); | ||
var _React2 = _interopRequireWildcard(_React); | ||
var _react2 = _interopRequireDefault(_react); | ||
@@ -51,4 +52,4 @@ function IsomorphicRenderer(alt, App) { | ||
return function () { | ||
var app = _React2['default'].renderToString(_React2['default'].createElement(App)); | ||
var markup = _Iso2['default'].render(app, alt.takeSnapshot()); | ||
var app = _react2['default'].renderToString(_react2['default'].createElement(App)); | ||
var markup = _iso2['default'].render(app, alt.takeSnapshot()); | ||
alt.flush(); | ||
@@ -58,6 +59,6 @@ return markup; | ||
} else { | ||
_Iso2['default'].bootstrap(function (state, _, node) { | ||
var app = _React2['default'].createElement(App); | ||
_iso2['default'].bootstrap(function (state, _, node) { | ||
var app = _react2['default'].createElement(App); | ||
alt.bootstrap(state); | ||
_React2['default'].render(app, node); | ||
_react2['default'].render(app, node); | ||
}); | ||
@@ -64,0 +65,0 @@ } |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _defineProperty = function (obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: key == null || typeof Symbol == 'undefined' || key.constructor !== Symbol, configurable: true, writable: true }); }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x4, | ||
property = _x5, | ||
receiver = _x6; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; | ||
function _defineProperty(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var _assign = require('object-assign'); | ||
var _objectAssign = require('object-assign'); | ||
var _assign2 = _interopRequireWildcard(_assign); | ||
var _objectAssign2 = _interopRequireDefault(_objectAssign); | ||
var _makeFinalStore = require('./makeFinalStore'); | ||
var _makeFinalStore2 = _interopRequireWildcard(_makeFinalStore); | ||
var _makeFinalStore2 = _interopRequireDefault(_makeFinalStore); | ||
@@ -30,3 +32,3 @@ function timetravel(alt) { | ||
var history = _assign2['default']({ | ||
var history = _objectAssign2['default']({ | ||
max: 300 | ||
@@ -56,3 +58,3 @@ }, options); | ||
function TimeTravelStore() { | ||
var _this4 = this; | ||
var _this5 = this; | ||
@@ -69,7 +71,7 @@ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
// capture the initial snapshot | ||
captureMoment(alt.serialize(_defineProperty({}, _this4._storeName, _this4))); | ||
captureMoment(alt.serialize(_defineProperty({}, _this5._storeName, _this5))); | ||
// capture subsequent shots | ||
payloadStore.listen(function (_) { | ||
return captureMoment(alt.takeSnapshot(_this4._storeName)); | ||
return captureMoment(alt.takeSnapshot(_this5._storeName)); | ||
}); | ||
@@ -76,0 +78,0 @@ }); |
'use strict'; | ||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -10,11 +8,13 @@ value: true | ||
var _React = require('react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _React2 = _interopRequireWildcard(_React); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
function withAltContext(flux) { | ||
return function (Component) { | ||
return _React2['default'].createClass({ | ||
return _react2['default'].createClass({ | ||
childContextTypes: { | ||
flux: _React2['default'].PropTypes.object | ||
flux: _react2['default'].PropTypes.object | ||
}, | ||
@@ -27,3 +27,3 @@ | ||
render: function render() { | ||
return _React2['default'].createElement(Component, this.props); | ||
return _react2['default'].createElement(Component, this.props); | ||
} | ||
@@ -30,0 +30,0 @@ }); |
Sorry, the diff of this file is too big to display
9130
464259
Updatedes-symbol@1.1.2