Skip to content

Commit

Permalink
[CLEANUP beta] Fix ember-2-legacy support for Ember.Binding.
Browse files Browse the repository at this point in the history
The primary change here is to allow `Ember.Mixin.finishPartial` and
`Ember.Mixin.detectBinding` to be undefined/null. The reason for this is
that there is an annoying ordering issue. Basically, the environment
flags are present from when Ember itself boots, but the monkey patches
added by ember-2-legacy (`detectBinding` and `finishPartial`) are not
done until _after_ the main `ember.debug.js` / `ember.prod.js` files
have been processed. _Within_ the evaluation of the main `ember.*.js`
file, the environment variable has been set but these functions are
still missing. This means that _Ember itself_ (during evaluation of
`Ember.CoreObject`) causes an issue when it attempts to call
`Mixin.finishPartials`.
  • Loading branch information
rwjblue committed Jan 9, 2018
1 parent 89f989b commit 634924c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/ember-metal/lib/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ function applyMixin(obj, mixins, partial) {
replaceObserversAndListeners(obj, key, obj[key], value);
}

if (ENV._ENABLE_BINDING_SUPPORT && Mixin.detectBinding(key)) {
if (ENV._ENABLE_BINDING_SUPPORT && typeof Mixin.detectBinding === 'function' && Mixin.detectBinding(key)) {
meta.writeBindings(key, value);
}

defineProperty(obj, key, desc, value, meta);
}

if (ENV._ENABLE_BINDING_SUPPORT && !partial) { // don't apply to prototype
if (ENV._ENABLE_BINDING_SUPPORT && !partial && typeof Mixin.finishProtype === 'function') {
Mixin.finishPartial(obj, meta);
}

Expand Down
7 changes: 0 additions & 7 deletions packages/ember-runtime/lib/system/core_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
Mixin,
REQUIRED,
defineProperty,
Binding,
ComputedProperty,
computed,
InjectedProperty,
Expand Down Expand Up @@ -495,12 +494,6 @@ CoreObject.PrototypeMixin = Mixin.create({
m.setSourceDestroyed();
},

bind(to, from) {
if (!(from instanceof Binding)) { from = Binding.from(from); }
from.to(to).connect(this);
return from;
},

/**
Returns a string representation which attempts to provide more information
than Javascript's `toString` typically does, in a generic way for all Ember
Expand Down

0 comments on commit 634924c

Please sign in to comment.