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

Add Ember.immediateObserver support #26

Merged
merged 5 commits into from
Dec 14, 2017

Conversation

thoov
Copy link
Member

@thoov thoov commented Dec 6, 2017

Related: emberjs/ember.js#15894

Closes #8

@thoov
Copy link
Member Author

thoov commented Dec 6, 2017

I still need to add Function.prototype support

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me so far. I think we still need a test for the prototype extension code, right?

@thoov
Copy link
Member Author

thoov commented Dec 11, 2017

Yes still need to add a test for this case

@thoov
Copy link
Member Author

thoov commented Dec 12, 2017

@rwjblue Should be good now.

@thoov thoov force-pushed the immediate-observer branch from 8556c66 to fab5d36 Compare December 13, 2017 20:48
@rwjblue
Copy link
Member

rwjblue commented Dec 13, 2017

Dang, I made a rebase conflict by merging the other PR.

@thoov thoov force-pushed the immediate-observer branch from fab5d36 to 880aa7d Compare December 13, 2017 23:53
@thoov
Copy link
Member Author

thoov commented Dec 14, 2017

@rwjblue Fixed. We are going to be hitting a bunch of conflicts as they all touch config/environment.js and most hit index.js

¯\_(ツ)_/¯

should be good to go

const { EmberENV } = config;

if (EmberENV.EXTEND_PROTOTYPES && EmberENV.EXTEND_PROTOTYPES.Function === true && Ember.immediateObserver) {
Function.prototype.observesImmediately = Ember.immediateObserver;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to a vendor file as well? Sorry for not noticing until the last minute :(

return _Ember.observer.apply(this, arguments);
}

const EXTEND_PROTOTYPES = JSON.parse(decodeURIComponent(document.getElementsByName('dummy/config/environment')[0].content)).EmberENV.EXTEND_PROTOTYPES;
Copy link
Member Author

@thoov thoov Dec 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwjblue I thought that global.EmberEnv contains the merged configs. I see the correctly merged content inside of the meta tag but not on the global. Do you know of a way to grab this from within vendor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thoov
Copy link
Member Author

thoov commented Dec 14, 2017

@rwjblue This should be good now

@rwjblue rwjblue merged commit c087143 into emberjs:master Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants