diff --git a/dist/alt-with-runtime.js b/dist/alt-with-runtime.js index 7c7de677..ebeca5b9 100644 --- a/dist/alt-with-runtime.js +++ b/dist/alt-with-runtime.js @@ -14,7 +14,6 @@ var ACTION_DISPATCHER = Symbol("action dispatcher storage"); var ACTION_HANDLER = Symbol("action creator handler"); var ACTION_KEY = Symbol("holds the actions uid symbol for listening"); var ACTION_UID = Symbol("the actions uid name"); -var BOOTSTRAP_FLAG = VariableSymbol("has bootstrap"); var EE = Symbol("event emitter instance"); var INIT_SNAPSHOT = Symbol("init snapshot storage"); var LAST_SNAPSHOT = Symbol("last snapshot storage"); @@ -111,7 +110,6 @@ var ActionCreator = (function () { this[ACTION_DISPATCHER] = alt.dispatcher; this[ACTION_UID] = name; this[ACTION_HANDLER] = action.bind(this); - this[BOOTSTRAP_FLAG] = false; this.actions = actions; this.alt = alt; } @@ -384,13 +382,6 @@ var Alt = (function () { store[LIFECYCLE].bootstrap(); } }); - - if (typeof window !== "undefined") { - if (this[BOOTSTRAP_FLAG]) { - throw new ReferenceError("Stores have already been bootstrapped"); - } - this[BOOTSTRAP_FLAG] = true; - } }, writable: true, configurable: true diff --git a/dist/alt.js b/dist/alt.js index b868eaf0..ca4f2004 100644 --- a/dist/alt.js +++ b/dist/alt.js @@ -18,7 +18,6 @@ var ACTION_DISPATCHER = Symbol("action dispatcher storage"); var ACTION_HANDLER = Symbol("action creator handler"); var ACTION_KEY = Symbol("holds the actions uid symbol for listening"); var ACTION_UID = Symbol("the actions uid name"); -var BOOTSTRAP_FLAG = VariableSymbol("has bootstrap"); var EE = Symbol("event emitter instance"); var INIT_SNAPSHOT = Symbol("init snapshot storage"); var LAST_SNAPSHOT = Symbol("last snapshot storage"); @@ -115,7 +114,6 @@ var ActionCreator = (function () { this[ACTION_DISPATCHER] = alt.dispatcher; this[ACTION_UID] = name; this[ACTION_HANDLER] = action.bind(this); - this[BOOTSTRAP_FLAG] = false; this.actions = actions; this.alt = alt; } @@ -388,13 +386,6 @@ var Alt = (function () { store[LIFECYCLE].bootstrap(); } }); - - if (typeof window !== "undefined") { - if (this[BOOTSTRAP_FLAG]) { - throw new ReferenceError("Stores have already been bootstrapped"); - } - this[BOOTSTRAP_FLAG] = true; - } }, writable: true, configurable: true diff --git a/src/alt.js b/src/alt.js index 108eeb56..2143fece 100644 --- a/src/alt.js +++ b/src/alt.js @@ -12,7 +12,6 @@ let ACTION_DISPATCHER = Symbol('action dispatcher storage') let ACTION_HANDLER = Symbol('action creator handler') let ACTION_KEY = Symbol('holds the actions uid symbol for listening') let ACTION_UID = Symbol('the actions uid name') -let BOOTSTRAP_FLAG = VariableSymbol('has bootstrap') let EE = Symbol('event emitter instance') let INIT_SNAPSHOT = Symbol('init snapshot storage') let LAST_SNAPSHOT = Symbol('last snapshot storage') @@ -87,7 +86,6 @@ class ActionCreator { this[ACTION_DISPATCHER] = alt.dispatcher this[ACTION_UID] = name this[ACTION_HANDLER] = action.bind(this) - this[BOOTSTRAP_FLAG] = false this.actions = actions this.alt = alt } @@ -333,13 +331,6 @@ your own custom identifier for each store` store[LIFECYCLE].bootstrap() } }) - - if (typeof window !== 'undefined') { - if (this[BOOTSTRAP_FLAG]) { - throw new ReferenceError('Stores have already been bootstrapped') - } - this[BOOTSTRAP_FLAG] = true - } } // Instance type methods for injecting alt into your application as context diff --git a/test/index.js b/test/index.js index f79aa1ec..85e6e3cd 100644 --- a/test/index.js +++ b/test/index.js @@ -364,21 +364,12 @@ module.exports = { 'bootstrapping'() { alt.bootstrap('{"MyStore":{"name":"bee"}}') - assert.equal(myStore.getState().name, 'bee', 'on server I can bootstrap many times') + assert.equal(myStore.getState().name, 'bee', 'I can bootstrap many times') - try { - // simulate the browser - global.window = {}; - - alt.bootstrap('{}') - // Attempting to bootstrap more than once - alt.bootstrap('{"MyStore":{"name":"bee"}}') + alt.bootstrap('{}') - assert.equal(true, false, 'I was able bootstrap more than once which is bad') - } catch (e) { - assert.equal(e instanceof ReferenceError, true, 'can only bootstrap once') - assert.equal(e.message, 'Stores have already been bootstrapped', 'can only bootstrap once') - } + alt.bootstrap('{"MyStore":{"name":"monkey"}}') + assert.equal(myStore.getState().name, 'monkey', 'I can bootstrap many times') }, 'variadic actions'() {