From a76e048e940429612d534ff4053d92af9ce8c034 Mon Sep 17 00:00:00 2001 From: Josh Perez Date: Fri, 24 Apr 2015 18:16:42 -0700 Subject: [PATCH] Remove deprecation warnings --- src/alt/AltStore.js | 15 --------------- src/alt/utils/warnings.js | 7 ------- test/before-and-after-test.js | 26 ++------------------------ 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/alt/AltStore.js b/src/alt/AltStore.js index 11b787d5..ce52fbb3 100644 --- a/src/alt/AltStore.js +++ b/src/alt/AltStore.js @@ -1,7 +1,6 @@ import EventEmitter from 'eventemitter3' import assign from 'object-assign' import Symbol from 'es-symbol' -import { deprecatedBeforeAfterEachWarning } from './utils/warnings' import * as Sym from './symbols/symbols' const { @@ -37,13 +36,6 @@ export default class AltStore { this.dispatchToken = alt.dispatcher.register((payload) => { if (model[LIFECYCLE].beforeEach) { model[LIFECYCLE].beforeEach(payload, this[STATE_CONTAINER]) - } else if (typeof model.beforeEach === 'function') { - deprecatedBeforeAfterEachWarning() - model.beforeEach( - payload.action.toString(), - payload.data, - this[STATE_CONTAINER] - ) } if (model[LISTENERS][payload.action]) { @@ -66,13 +58,6 @@ export default class AltStore { if (model[LIFECYCLE].afterEach) { model[LIFECYCLE].afterEach(payload, this[STATE_CONTAINER]) - } else if (typeof model.afterEach === 'function') { - deprecatedBeforeAfterEachWarning() - model.afterEach( - payload.action.toString(), - payload.data, - this[STATE_CONTAINER] - ) } }) diff --git a/src/alt/utils/warnings.js b/src/alt/utils/warnings.js index 9c73ad4f..19e55e22 100644 --- a/src/alt/utils/warnings.js +++ b/src/alt/utils/warnings.js @@ -4,10 +4,3 @@ export function warn(msg) { console.warn(new ReferenceError(msg)) } } - -export function deprecatedBeforeAfterEachWarning() { - warn( - 'beforeEach/afterEach functions on the store are deprecated ' + - 'use beforeEach/afterEach as a lifecycle method instead' - ) -} diff --git a/test/before-and-after-test.js b/test/before-and-after-test.js index 46be86f2..775adb2e 100644 --- a/test/before-and-after-test.js +++ b/test/before-and-after-test.js @@ -1,5 +1,6 @@ -import Alt from '../dist/alt-with-runtime' +import Alt from '../' import { assert } from 'chai' + import sinon from 'sinon' const alt = new Alt() @@ -85,28 +86,5 @@ export default { assert.ok(beforeValue === 1, 'before has current state') assert.ok(afterValue === 2, 'after has next state') }, - - 'deprecated warning'() { - console.warn = sinon.spy() - - class Foo { - constructor() { - this.bindListeners({ - change: action.fire - }) - } - beforeEach() { } - afterEach() { } - change() { } - } - - assert(console.warn.callCount === 0) - - alt.createStore(Foo) - - action.fire() - - assert.ok(console.warn.calledTwice) - } } }