From 8627dfa2cbbc66fa32f0d910bb676aedd2882b44 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 9 Jan 2018 16:23:56 -0500 Subject: [PATCH] [CLEANUP beta] Remove `sync` runloop queue. `sync` queue was only used/present for bindings to synchronize, and Ember.Binding (along with related code) is now completely gone. --- packages/ember-metal/lib/run_loop.js | 10 +----- .../tests/run_loop/schedule_test.js | 12 +------ .../ember-metal/tests/run_loop/sync_test.js | 35 ------------------- 3 files changed, 2 insertions(+), 55 deletions(-) delete mode 100644 packages/ember-metal/tests/run_loop/sync_test.js diff --git a/packages/ember-metal/lib/run_loop.js b/packages/ember-metal/lib/run_loop.js index 994329e8bf5..a4868fff509 100644 --- a/packages/ember-metal/lib/run_loop.js +++ b/packages/ember-metal/lib/run_loop.js @@ -2,10 +2,6 @@ import { assert, isTesting } from 'ember-debug'; import { onErrorTarget } from './error_handler'; -import { - beginPropertyChanges, - endPropertyChanges -} from './property_events'; import Backburner from 'backburner'; function onBegin(current) { @@ -16,11 +12,7 @@ function onEnd(current, next) { run.currentRunLoop = next; } -const backburner = new Backburner(['sync', 'actions', 'destroy'], { - sync: { - before: beginPropertyChanges, - after: endPropertyChanges - }, +const backburner = new Backburner(['actions', 'destroy'], { defaultQueue: 'actions', onBegin, onEnd, diff --git a/packages/ember-metal/tests/run_loop/schedule_test.js b/packages/ember-metal/tests/run_loop/schedule_test.js index 6470894c368..0e0af27fe67 100644 --- a/packages/ember-metal/tests/run_loop/schedule_test.js +++ b/packages/ember-metal/tests/run_loop/schedule_test.js @@ -48,11 +48,6 @@ moduleFor('system/run_loop/schedule_test', class extends AbstractTestCase { let runLoop = run.currentRunLoop; assert.ok(runLoop, 'run loop present'); - run.schedule('sync', () => { - order.push('sync'); - assert.equal(runLoop, run.currentRunLoop, 'same run loop used'); - }); - run.schedule('actions', () => { order.push('actions'); assert.equal(runLoop, run.currentRunLoop, 'same run loop used'); @@ -61,11 +56,6 @@ moduleFor('system/run_loop/schedule_test', class extends AbstractTestCase { order.push('actions'); assert.equal(runLoop, run.currentRunLoop, 'same run loop used'); }); - - run.schedule('sync', () => { - order.push('sync'); - assert.equal(runLoop, run.currentRunLoop, 'same run loop used'); - }); }); run.schedule('destroy', () => { @@ -74,7 +64,7 @@ moduleFor('system/run_loop/schedule_test', class extends AbstractTestCase { }); }); - assert.deepEqual(order, ['sync', 'actions', 'sync', 'actions', 'destroy']); + assert.deepEqual(order, ['actions', 'actions', 'destroy']); } ['@test makes sure it does not trigger an autorun during testing']() { diff --git a/packages/ember-metal/tests/run_loop/sync_test.js b/packages/ember-metal/tests/run_loop/sync_test.js deleted file mode 100644 index 30b95893499..00000000000 --- a/packages/ember-metal/tests/run_loop/sync_test.js +++ /dev/null @@ -1,35 +0,0 @@ -import { run } 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) { - run.schedule('sync', syncfunc); - } - run.schedule('actions', cntup); - } - - syncfunc(); - - assert.equal(cnt, 1, 'should not run action yet'); - run.sync(); - - assert.equal(cnt, 5, 'should have run sync queue continuously'); - }); - - assert.equal(cnt, 10, 'should flush actions now too'); - } - - ['@test calling sync() outside a run loop does not cause an error'](assert) { - assert.expect(0); - - run.sync(); - } -}); -