Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP] Remove sync queue from @ember/runloop. #17940

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/@ember/deprecated-features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
32 changes: 5 additions & 27 deletions packages/@ember/runloop/index.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
26 changes: 11 additions & 15 deletions packages/@ember/runloop/tests/schedule_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -80,7 +76,7 @@ moduleFor(
});
});

assert.deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'destroy']);
assert.deepEqual(order, ['actions', 'afterRender', 'actions', 'afterRender', 'destroy']);
}
}
);
32 changes: 0 additions & 32 deletions packages/@ember/runloop/tests/sync_test.js

This file was deleted.