diff --git a/dist/alt-browser-with-addons.js b/dist/alt-browser-with-addons.js index 3c98f22b..63cfc9e9 100644 --- a/dist/alt-browser-with-addons.js +++ b/dist/alt-browser-with-addons.js @@ -1068,7 +1068,7 @@ function NoopClass() {} var builtIns = Object.getOwnPropertyNames(NoopClass); var builtInProto = Object.getOwnPropertyNames(NoopClass.prototype); -var getInternalMethods = function (obj, excluded) { +function getInternalMethods(obj, excluded) { return Object.getOwnPropertyNames(obj).reduce(function (value, m) { if (excluded.indexOf(m) !== -1) { return value; @@ -1077,7 +1077,7 @@ var getInternalMethods = function (obj, excluded) { value[m] = obj[m]; return value; }, {}); -}; +} var AltStore = (function () { function AltStore(dispatcher, model, state, StoreModel) { @@ -1316,7 +1316,7 @@ var StoreMixinEssentials = { } }; -var setAppState = function (instance, data, onStore) { +function setAppState(instance, data, onStore) { var obj = instance.deserialize(data); Object.keys(obj).forEach(function (key) { var store = instance.stores[key]; @@ -1328,9 +1328,9 @@ var setAppState = function (instance, data, onStore) { onStore(store); } }); -}; +} -var snapshot = function (instance) { +function snapshot(instance) { for (var _len = arguments.length, storeNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { storeNames[_key - 1] = arguments[_key]; } @@ -1345,17 +1345,17 @@ var snapshot = function (instance) { obj[key] = customSnapshot ? customSnapshot : store.getState(); return obj; }, {}); -}; +} -var saveInitialSnapshot = function (instance, key) { +function saveInitialSnapshot(instance, key) { var state = instance.stores[key][STATE_CONTAINER]; var initial = instance.deserialize(instance[INIT_SNAPSHOT]); initial[key] = state; instance[INIT_SNAPSHOT] = instance.serialize(initial); instance[LAST_SNAPSHOT] = instance[INIT_SNAPSHOT]; -}; +} -var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) { +function filterSnapshotOfStores(instance, serializedSnapshot, storeNames) { var stores = instance.deserialize(serializedSnapshot); var storesToReset = storeNames.reduce(function (obj, name) { if (!stores[name]) { @@ -1365,7 +1365,7 @@ var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) return obj; }, {}); return instance.serialize(storesToReset); -}; +} function createStoreFromObject(alt, StoreModel, key) { var storeInstance = undefined; @@ -1408,8 +1408,8 @@ function createStoreFromObject(alt, StoreModel, key) { } function createStoreFromClass(alt, StoreModel, key) { - for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - args[_key - 3] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + argsForConstructor[_key - 3] = arguments[_key]; } var storeInstance = undefined; @@ -1451,7 +1451,7 @@ function createStoreFromClass(alt, StoreModel, key) { Store.prototype[LISTENERS] = {}; Store.prototype[PUBLIC_METHODS] = {}; - var store = _applyConstructor(Store, args); + var store = _applyConstructor(Store, argsForConstructor); storeInstance = assign(new AltStore(alt.dispatcher, store, null, StoreModel), getInternalMethods(StoreModel, builtIns)); @@ -1552,8 +1552,8 @@ var Alt = (function () { value: function createActions(ActionsClass) { var _this8 = this; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + argsForConstructor[_key - 2] = arguments[_key]; } var exportObj = arguments[1] === undefined ? {} : arguments[1]; @@ -1602,7 +1602,7 @@ var Alt = (function () { return ActionsGenerator; })(ActionsClass); - assign(actions, _applyConstructor(ActionsGenerator, args)); + assign(actions, _applyConstructor(ActionsGenerator, argsForConstructor)); })(); } else { assign(actions, ActionsClass); @@ -1675,18 +1675,20 @@ var Alt = (function () { // Instance type methods for injecting alt into your application as context value: function addActions(name, ActionsClass) { - this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions(ActionsClass); + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions.apply(this, [ActionsClass].concat(args)); } }, addStore: { value: function addStore(name, StoreModel) { - var _ref; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } - (_ref = this).createStore.apply(_ref, [StoreModel, name].concat(args)); + this.createStore.apply(this, [StoreModel, name].concat(args)); } }, getActions: { diff --git a/dist/alt-browser.js b/dist/alt-browser.js index 874993c8..cf9dc34e 100644 --- a/dist/alt-browser.js +++ b/dist/alt-browser.js @@ -816,7 +816,7 @@ function NoopClass() {} var builtIns = Object.getOwnPropertyNames(NoopClass); var builtInProto = Object.getOwnPropertyNames(NoopClass.prototype); -var getInternalMethods = function (obj, excluded) { +function getInternalMethods(obj, excluded) { return Object.getOwnPropertyNames(obj).reduce(function (value, m) { if (excluded.indexOf(m) !== -1) { return value; @@ -825,7 +825,7 @@ var getInternalMethods = function (obj, excluded) { value[m] = obj[m]; return value; }, {}); -}; +} var AltStore = (function () { function AltStore(dispatcher, model, state, StoreModel) { @@ -1064,7 +1064,7 @@ var StoreMixinEssentials = { } }; -var setAppState = function (instance, data, onStore) { +function setAppState(instance, data, onStore) { var obj = instance.deserialize(data); Object.keys(obj).forEach(function (key) { var store = instance.stores[key]; @@ -1076,9 +1076,9 @@ var setAppState = function (instance, data, onStore) { onStore(store); } }); -}; +} -var snapshot = function (instance) { +function snapshot(instance) { for (var _len = arguments.length, storeNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { storeNames[_key - 1] = arguments[_key]; } @@ -1093,17 +1093,17 @@ var snapshot = function (instance) { obj[key] = customSnapshot ? customSnapshot : store.getState(); return obj; }, {}); -}; +} -var saveInitialSnapshot = function (instance, key) { +function saveInitialSnapshot(instance, key) { var state = instance.stores[key][STATE_CONTAINER]; var initial = instance.deserialize(instance[INIT_SNAPSHOT]); initial[key] = state; instance[INIT_SNAPSHOT] = instance.serialize(initial); instance[LAST_SNAPSHOT] = instance[INIT_SNAPSHOT]; -}; +} -var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) { +function filterSnapshotOfStores(instance, serializedSnapshot, storeNames) { var stores = instance.deserialize(serializedSnapshot); var storesToReset = storeNames.reduce(function (obj, name) { if (!stores[name]) { @@ -1113,7 +1113,7 @@ var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) return obj; }, {}); return instance.serialize(storesToReset); -}; +} function createStoreFromObject(alt, StoreModel, key) { var storeInstance = undefined; @@ -1156,8 +1156,8 @@ function createStoreFromObject(alt, StoreModel, key) { } function createStoreFromClass(alt, StoreModel, key) { - for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - args[_key - 3] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + argsForConstructor[_key - 3] = arguments[_key]; } var storeInstance = undefined; @@ -1199,7 +1199,7 @@ function createStoreFromClass(alt, StoreModel, key) { Store.prototype[LISTENERS] = {}; Store.prototype[PUBLIC_METHODS] = {}; - var store = _applyConstructor(Store, args); + var store = _applyConstructor(Store, argsForConstructor); storeInstance = assign(new AltStore(alt.dispatcher, store, null, StoreModel), getInternalMethods(StoreModel, builtIns)); @@ -1300,8 +1300,8 @@ var Alt = (function () { value: function createActions(ActionsClass) { var _this8 = this; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + argsForConstructor[_key - 2] = arguments[_key]; } var exportObj = arguments[1] === undefined ? {} : arguments[1]; @@ -1350,7 +1350,7 @@ var Alt = (function () { return ActionsGenerator; })(ActionsClass); - assign(actions, _applyConstructor(ActionsGenerator, args)); + assign(actions, _applyConstructor(ActionsGenerator, argsForConstructor)); })(); } else { assign(actions, ActionsClass); @@ -1423,18 +1423,20 @@ var Alt = (function () { // Instance type methods for injecting alt into your application as context value: function addActions(name, ActionsClass) { - this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions(ActionsClass); + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions.apply(this, [ActionsClass].concat(args)); } }, addStore: { value: function addStore(name, StoreModel) { - var _ref; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } - (_ref = this).createStore.apply(_ref, [StoreModel, name].concat(args)); + this.createStore.apply(this, [StoreModel, name].concat(args)); } }, getActions: { diff --git a/dist/alt-with-runtime.js b/dist/alt-with-runtime.js index 408a21b2..65152258 100644 --- a/dist/alt-with-runtime.js +++ b/dist/alt-with-runtime.js @@ -71,7 +71,7 @@ function NoopClass() {} var builtIns = Object.getOwnPropertyNames(NoopClass); var builtInProto = Object.getOwnPropertyNames(NoopClass.prototype); -var getInternalMethods = function (obj, excluded) { +function getInternalMethods(obj, excluded) { return Object.getOwnPropertyNames(obj).reduce(function (value, m) { if (excluded.indexOf(m) !== -1) { return value; @@ -80,7 +80,7 @@ var getInternalMethods = function (obj, excluded) { value[m] = obj[m]; return value; }, {}); -}; +} var AltStore = (function () { function AltStore(dispatcher, model, state, StoreModel) { @@ -317,7 +317,7 @@ var StoreMixinEssentials = { } }; -var setAppState = function (instance, data, onStore) { +function setAppState(instance, data, onStore) { var obj = instance.deserialize(data); Object.keys(obj).forEach(function (key) { var store = instance.stores[key]; @@ -329,9 +329,9 @@ var setAppState = function (instance, data, onStore) { onStore(store); } }); -}; +} -var snapshot = function (instance) { +function snapshot(instance) { for (var _len = arguments.length, storeNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { storeNames[_key - 1] = arguments[_key]; } @@ -346,17 +346,17 @@ var snapshot = function (instance) { obj[key] = customSnapshot ? customSnapshot : store.getState(); return obj; }, {}); -}; +} -var saveInitialSnapshot = function (instance, key) { +function saveInitialSnapshot(instance, key) { var state = instance.stores[key][STATE_CONTAINER]; var initial = instance.deserialize(instance[INIT_SNAPSHOT]); initial[key] = state; instance[INIT_SNAPSHOT] = instance.serialize(initial); instance[LAST_SNAPSHOT] = instance[INIT_SNAPSHOT]; -}; +} -var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) { +function filterSnapshotOfStores(instance, serializedSnapshot, storeNames) { var stores = instance.deserialize(serializedSnapshot); var storesToReset = storeNames.reduce(function (obj, name) { if (!stores[name]) { @@ -366,7 +366,7 @@ var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) return obj; }, {}); return instance.serialize(storesToReset); -}; +} function createStoreFromObject(alt, StoreModel, key) { var storeInstance = undefined; @@ -409,8 +409,8 @@ function createStoreFromObject(alt, StoreModel, key) { } function createStoreFromClass(alt, StoreModel, key) { - for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - args[_key - 3] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + argsForConstructor[_key - 3] = arguments[_key]; } var storeInstance = undefined; @@ -451,7 +451,7 @@ function createStoreFromClass(alt, StoreModel, key) { Store.prototype[LISTENERS] = {}; Store.prototype[PUBLIC_METHODS] = {}; - var store = babelHelpers.applyConstructor(Store, args); + var store = babelHelpers.applyConstructor(Store, argsForConstructor); storeInstance = assign(new AltStore(alt.dispatcher, store, null, StoreModel), getInternalMethods(StoreModel, builtIns)); @@ -551,8 +551,8 @@ var Alt = (function () { value: function createActions(ActionsClass) { var _this8 = this; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + argsForConstructor[_key - 2] = arguments[_key]; } var exportObj = arguments[1] === undefined ? {} : arguments[1]; @@ -599,7 +599,7 @@ var Alt = (function () { return ActionsGenerator; })(ActionsClass); - assign(actions, babelHelpers.applyConstructor(ActionsGenerator, args)); + assign(actions, babelHelpers.applyConstructor(ActionsGenerator, argsForConstructor)); })(); } else { assign(actions, ActionsClass); @@ -672,7 +672,11 @@ var Alt = (function () { // Instance type methods for injecting alt into your application as context value: function addActions(name, ActionsClass) { - this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions(ActionsClass); + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions.apply(this, [ActionsClass].concat(args)); } }, addStore: { diff --git a/dist/alt.js b/dist/alt.js index 20bc4aee..cae84289 100644 --- a/dist/alt.js +++ b/dist/alt.js @@ -85,7 +85,7 @@ function NoopClass() {} var builtIns = Object.getOwnPropertyNames(NoopClass); var builtInProto = Object.getOwnPropertyNames(NoopClass.prototype); -var getInternalMethods = function (obj, excluded) { +function getInternalMethods(obj, excluded) { return Object.getOwnPropertyNames(obj).reduce(function (value, m) { if (excluded.indexOf(m) !== -1) { return value; @@ -94,7 +94,7 @@ var getInternalMethods = function (obj, excluded) { value[m] = obj[m]; return value; }, {}); -}; +} var AltStore = (function () { function AltStore(dispatcher, model, state, StoreModel) { @@ -333,7 +333,7 @@ var StoreMixinEssentials = { } }; -var setAppState = function (instance, data, onStore) { +function setAppState(instance, data, onStore) { var obj = instance.deserialize(data); Object.keys(obj).forEach(function (key) { var store = instance.stores[key]; @@ -345,9 +345,9 @@ var setAppState = function (instance, data, onStore) { onStore(store); } }); -}; +} -var snapshot = function (instance) { +function snapshot(instance) { for (var _len = arguments.length, storeNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { storeNames[_key - 1] = arguments[_key]; } @@ -362,17 +362,17 @@ var snapshot = function (instance) { obj[key] = customSnapshot ? customSnapshot : store.getState(); return obj; }, {}); -}; +} -var saveInitialSnapshot = function (instance, key) { +function saveInitialSnapshot(instance, key) { var state = instance.stores[key][STATE_CONTAINER]; var initial = instance.deserialize(instance[INIT_SNAPSHOT]); initial[key] = state; instance[INIT_SNAPSHOT] = instance.serialize(initial); instance[LAST_SNAPSHOT] = instance[INIT_SNAPSHOT]; -}; +} -var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) { +function filterSnapshotOfStores(instance, serializedSnapshot, storeNames) { var stores = instance.deserialize(serializedSnapshot); var storesToReset = storeNames.reduce(function (obj, name) { if (!stores[name]) { @@ -382,7 +382,7 @@ var filterSnapshotOfStores = function (instance, serializedSnapshot, storeNames) return obj; }, {}); return instance.serialize(storesToReset); -}; +} function createStoreFromObject(alt, StoreModel, key) { var storeInstance = undefined; @@ -425,8 +425,8 @@ function createStoreFromObject(alt, StoreModel, key) { } function createStoreFromClass(alt, StoreModel, key) { - for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - args[_key - 3] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { + argsForConstructor[_key - 3] = arguments[_key]; } var storeInstance = undefined; @@ -468,7 +468,7 @@ function createStoreFromClass(alt, StoreModel, key) { Store.prototype[LISTENERS] = {}; Store.prototype[PUBLIC_METHODS] = {}; - var store = _applyConstructor(Store, args); + var store = _applyConstructor(Store, argsForConstructor); storeInstance = assign(new AltStore(alt.dispatcher, store, null, StoreModel), getInternalMethods(StoreModel, builtIns)); @@ -569,8 +569,8 @@ var Alt = (function () { value: function createActions(ActionsClass) { var _this8 = this; - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; + for (var _len = arguments.length, argsForConstructor = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + argsForConstructor[_key - 2] = arguments[_key]; } var exportObj = arguments[1] === undefined ? {} : arguments[1]; @@ -619,7 +619,7 @@ var Alt = (function () { return ActionsGenerator; })(ActionsClass); - assign(actions, _applyConstructor(ActionsGenerator, args)); + assign(actions, _applyConstructor(ActionsGenerator, argsForConstructor)); })(); } else { assign(actions, ActionsClass); @@ -692,7 +692,11 @@ var Alt = (function () { // Instance type methods for injecting alt into your application as context value: function addActions(name, ActionsClass) { - this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions(ActionsClass); + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) : this.createActions.apply(this, [ActionsClass].concat(args)); } }, addStore: { diff --git a/src/alt.js b/src/alt.js index 0f3c7539..36dbdcc6 100644 --- a/src/alt.js +++ b/src/alt.js @@ -76,7 +76,7 @@ function NoopClass() { } const builtIns = Object.getOwnPropertyNames(NoopClass) const builtInProto = Object.getOwnPropertyNames(NoopClass.prototype) -const getInternalMethods = (obj, excluded) => { +function getInternalMethods(obj, excluded) { return Object.getOwnPropertyNames(obj).reduce((value, m) => { if (excluded.indexOf(m) !== -1) { return value @@ -323,7 +323,7 @@ const StoreMixinEssentials = { } } -const setAppState = (instance, data, onStore) => { +function setAppState(instance, data, onStore) { const obj = instance.deserialize(data) Object.keys(obj).forEach((key) => { const store = instance.stores[key] @@ -337,7 +337,7 @@ const setAppState = (instance, data, onStore) => { }) } -const snapshot = (instance, ...storeNames) => { +function snapshot(instance, ...storeNames) { const stores = storeNames.length ? storeNames : Object.keys(instance.stores) return stores.reduce((obj, key) => { const store = instance.stores[key] @@ -350,7 +350,7 @@ const snapshot = (instance, ...storeNames) => { }, {}) } -const saveInitialSnapshot = (instance, key) => { +function saveInitialSnapshot(instance, key) { const state = instance.stores[key][STATE_CONTAINER] const initial = instance.deserialize(instance[INIT_SNAPSHOT]) initial[key] = state @@ -358,7 +358,7 @@ const saveInitialSnapshot = (instance, key) => { instance[LAST_SNAPSHOT] = instance[INIT_SNAPSHOT] } -const filterSnapshotOfStores = (instance, serializedSnapshot, storeNames) => { +function filterSnapshotOfStores(instance, serializedSnapshot, storeNames) { const stores = instance.deserialize(serializedSnapshot) const storesToReset = storeNames.reduce((obj, name) => { if (!stores[name]) { @@ -413,7 +413,7 @@ function createStoreFromObject(alt, StoreModel, key) { return storeInstance } -function createStoreFromClass(alt, StoreModel, key, ...args) { +function createStoreFromClass(alt, StoreModel, key, ...argsForConstructor) { let storeInstance // Creating a class here so we don't overload the provided store's @@ -442,7 +442,7 @@ function createStoreFromClass(alt, StoreModel, key, ...args) { Store.prototype[LISTENERS] = {} Store.prototype[PUBLIC_METHODS] = {} - const store = new Store(...args) + const store = new Store(...argsForConstructor) storeInstance = assign( new AltStore(alt.dispatcher, store, null, StoreModel), @@ -523,7 +523,7 @@ class Alt { return action } - createActions(ActionsClass, exportObj = {}, ...args) { + createActions(ActionsClass, exportObj = {}, ...argsForConstructor) { const actions = {} const key = ActionsClass.name || ActionsClass.displayName || '' @@ -544,7 +544,7 @@ class Alt { } } - assign(actions, new ActionsGenerator(...args)) + assign(actions, new ActionsGenerator(...argsForConstructor)) } else { assign(actions, ActionsClass) } @@ -604,10 +604,10 @@ class Alt { // Instance type methods for injecting alt into your application as context - addActions(name, ActionsClass) { + addActions(name, ActionsClass, ...args) { this.actions[name] = Array.isArray(ActionsClass) ? this.generateActions.apply(this, ActionsClass) - : this.createActions(ActionsClass) + : this.createActions(ActionsClass, ...args) } addStore(name, StoreModel, ...args) { diff --git a/test/index.js b/test/index.js index 204947a9..d07304fb 100644 --- a/test/index.js +++ b/test/index.js @@ -326,9 +326,9 @@ const interceptSnapshotStore = alt.createStore(InterceptSnapshotStore) class AltInstance extends Alt { constructor() { super() - this.addActions('myActions', MyActions) + this.addActions('myActions', MyActions, this) this.addActions('fauxActions', ['one', 'two']) - this.addStore('myStore', MyStore) + this.addStore('myStore', MyStore, this) } } @@ -1256,10 +1256,19 @@ const tests = { alt.createUnsavedStore(NoBootstrap, 'NoBootstrap') - const snapshot = JSON.parse(alt.takeSnapshot()) + let snapshot = JSON.parse(alt.takeSnapshot()) assert.isUndefined(snapshot.NoBootstrap, 'Store does not exist in snapshots') assert.isObject(snapshot.AltSecondStore, 'AltSecondStore exists') + + alt.createUnsavedStore({ + displayName: 'NoBootstrapObject' + }) + + snapshot = JSON.parse(alt.takeSnapshot()) + + assert.isUndefined(snapshot.NoBootstrapObject, 'Store does not exist in snapshots') + assert.isObject(snapshot.AltSecondStore, 'AltSecondStore exists') }, 'actions with no name are still ok'() {