diff --git a/packages/@ember/deprecated-features/index.ts b/packages/@ember/deprecated-features/index.ts index 417ad0ebcfb..bf488ee0bf2 100644 --- a/packages/@ember/deprecated-features/index.ts +++ b/packages/@ember/deprecated-features/index.ts @@ -5,7 +5,6 @@ export const SEND_ACTION = !!'3.4.0'; export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5'; -export const RUN_SYNC = !!'3.0.0-beta.4'; export const LOGGER = !!'3.2.0-beta.1'; export const MERGE = !!'3.6.0-beta.1'; export const ROUTER_EVENTS = !!'4.0.0'; diff --git a/packages/@ember/runloop/index.js b/packages/@ember/runloop/index.js index 88964627cf6..0895915cd1b 100644 --- a/packages/@ember/runloop/index.js +++ b/packages/@ember/runloop/index.js @@ -1,8 +1,6 @@ -import { assert, deprecate } from '@ember/debug'; +import { assert } from '@ember/debug'; import { onErrorTarget } from '@ember/-internals/error-handling'; -import { beginPropertyChanges, endPropertyChanges } from '@ember/-internals/metal'; import Backburner from 'backburner'; -import { RUN_SYNC } from '@ember/deprecated-features'; let currentRunLoop = null; export function getCurrentRunLoop() { @@ -46,24 +44,13 @@ export const queues = [ _rsvpErrorQueue, ]; -let backburnerOptions = { +export const backburner = new Backburner(queues, { defaultQueue: 'actions', onBegin, onEnd, onErrorTarget, onErrorMethod: 'onerror', -}; - -if (RUN_SYNC) { - queues.unshift('sync'); - - backburnerOptions.sync = { - before: beginPropertyChanges, - after: endPropertyChanges, - }; -} - -export const backburner = new Backburner(queues, backburnerOptions); +}); /** @module @ember/runloop @@ -324,12 +311,7 @@ export function end() { @return {*} Timer information for use in canceling, see `cancel`. @public */ -export function schedule(queue /*, target, method */) { - deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', { - id: 'ember-metal.run.sync', - until: '3.5.0', - }); - +export function schedule(/* queue, target, method */) { return backburner.schedule(...arguments); } @@ -469,11 +451,7 @@ export function once(...args) { @return {Object} Timer information for use in canceling, see `cancel`. @public */ -export function scheduleOnce(queue /*, target, method*/) { - deprecate(`Scheduling into the '${queue}' run loop queue is deprecated.`, queue !== 'sync', { - id: 'ember-metal.run.sync', - until: '3.5.0', - }); +export function scheduleOnce(/* queue, target, method*/) { return backburner.scheduleOnce(...arguments); } diff --git a/packages/@ember/runloop/tests/schedule_test.js b/packages/@ember/runloop/tests/schedule_test.js index 416f008839a..2368c5314f3 100644 --- a/packages/@ember/runloop/tests/schedule_test.js +++ b/packages/@ember/runloop/tests/schedule_test.js @@ -50,28 +50,24 @@ moduleFor( let runLoop = getCurrentRunLoop(); assert.ok(runLoop, 'run loop present'); - expectDeprecation(() => { - schedule('sync', () => { - order.push('sync'); - assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); - }); - }, `Scheduling into the 'sync' run loop queue is deprecated.`); - schedule('actions', () => { order.push('actions'); assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); + }); + + schedule('afterRender', () => { + order.push('afterRender'); + assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); + + schedule('afterRender', () => { + order.push('afterRender'); + assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); + }); schedule('actions', () => { order.push('actions'); assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); }); - - expectDeprecation(() => { - schedule('sync', () => { - order.push('sync'); - assert.equal(runLoop, getCurrentRunLoop(), 'same run loop used'); - }); - }, `Scheduling into the 'sync' run loop queue is deprecated.`); }); schedule('destroy', () => { @@ -80,7 +76,7 @@ moduleFor( }); }); - assert.deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'destroy']); + assert.deepEqual(order, ['actions', 'afterRender', 'actions', 'afterRender', 'destroy']); } } ); diff --git a/packages/@ember/runloop/tests/sync_test.js b/packages/@ember/runloop/tests/sync_test.js deleted file mode 100644 index eb124a2aee7..00000000000 --- a/packages/@ember/runloop/tests/sync_test.js +++ /dev/null @@ -1,32 +0,0 @@ -import { run, schedule } from '..'; -import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; - -moduleFor( - 'system/run_loop/sync_test', - class extends AbstractTestCase { - ['@test sync() will immediately flush the sync queue only'](assert) { - let cnt = 0; - - run(() => { - function cntup() { - cnt++; - } - - function syncfunc() { - if (++cnt < 5) { - expectDeprecation(() => { - schedule('sync', syncfunc); - }, `Scheduling into the 'sync' run loop queue is deprecated.`); - } - schedule('actions', cntup); - } - - syncfunc(); - - assert.equal(cnt, 1, 'should not run action yet'); - }); - - assert.equal(cnt, 10, 'should flush actions now too'); - } - } -);