|
1 | 1 | import PortMixin from 'ember-debug/mixins/port-mixin';
|
2 |
| -import { compareVersion } from 'ember-debug/utils/version'; |
| 2 | +import bound from 'ember-debug/utils/bound-method'; |
3 | 3 | import { isComputed, isDescriptor, getDescriptorFor } from 'ember-debug/utils/type-check';
|
| 4 | +import { compareVersion } from 'ember-debug/utils/version'; |
4 | 5 | import { typeOf } from './utils/type-check';
|
5 | 6 |
|
6 | 7 | const Ember = window.Ember;
|
7 | 8 | const {
|
8 | 9 | Object: EmberObject, inspect: emberInspect, meta: emberMeta,
|
9 | 10 | computed, get, set, guidFor, isNone,
|
10 |
| - cacheFor, VERSION |
| 11 | + cacheFor, VERSION, run, |
11 | 12 | } = Ember;
|
12 | 13 | const { oneWay } = computed;
|
| 14 | +const { backburner, join } = run; |
13 | 15 |
|
14 | 16 | let glimmer;
|
15 | 17 | let metal;
|
@@ -266,21 +268,20 @@ export default EmberObject.extend(PortMixin, {
|
266 | 268 | });
|
267 | 269 | });
|
268 | 270 | }
|
269 |
| - // workaround for tests, since calling any runloop inside runloop will prevent any `settled` to be called |
270 |
| - setTimeout(() => Ember.run.next(this, this.updateCurrentObject), 300); |
271 | 271 | },
|
272 | 272 |
|
273 | 273 | init() {
|
274 | 274 | this._super();
|
275 | 275 | this.set('sentObjects', {});
|
276 |
| - Ember.run.next(this, this.updateCurrentObject); |
| 276 | + backburner.on('end', bound(this, this.updateCurrentObject)); |
277 | 277 | },
|
278 | 278 |
|
279 | 279 | willDestroy() {
|
280 | 280 | this._super();
|
281 | 281 | for (let objectId in this.sentObjects) {
|
282 | 282 | this.releaseObject(objectId);
|
283 | 283 | }
|
| 284 | + backburner.off('end', bound(this, this.updateCurrentObject)); |
284 | 285 | },
|
285 | 286 |
|
286 | 287 | sentObjects: {},
|
@@ -391,7 +392,7 @@ export default EmberObject.extend(PortMixin, {
|
391 | 392 |
|
392 | 393 | saveProperty(objectId, prop, val) {
|
393 | 394 | let object = this.sentObjects[objectId];
|
394 |
| - set(object, prop, val); |
| 395 | + join(() => set(object, prop, val)); |
395 | 396 | },
|
396 | 397 |
|
397 | 398 | sendToConsole(objectId, prop) {
|
@@ -489,7 +490,6 @@ export default EmberObject.extend(PortMixin, {
|
489 | 490 | if (meta._debugReferences === 0) {
|
490 | 491 | this.dropObject(guid);
|
491 | 492 | }
|
492 |
| - |
493 | 493 | },
|
494 | 494 |
|
495 | 495 | dropObject(objectId) {
|
|
0 commit comments