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

- WIP, Refactorring. #370

Merged
merged 1 commit into from
May 28, 2015
Merged

Conversation

Mawaheb
Copy link
Contributor

@Mawaheb Mawaheb commented May 25, 2015

This PR, is made to see If I am on the right direction, Doing the right thing, and to hear any advice, suggestions, comments.

This is a WIP, Refactoring the code to use arrow functions and the new functions definition syntax on properties.

@teddyzeenny Please let me know what do you think.

_connect: function() {
let self = this;

_connect: () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't this be _connect() {?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ops, I actually wanted to restore it to it's original state, Any functions with a trailing . (eg .on(), .property() etc) gives me an error (unexpected .) when trying to refactor them!
Any workaround/suggestion for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should stop using .on and .property.

const { on, computed } = Ember;

_connect: on('init', function() {
}),

myProp: computed('key1', 'key2', function() {
  return this.get('key1') + this.get('key2);
})

@Mawaheb Mawaheb force-pushed the useArrowFunctions branch from 87c108d to c401fb3 Compare May 27, 2015 13:10
@Mawaheb
Copy link
Contributor Author

Mawaheb commented May 27, 2015

Ok, I think now this PR is ready..
I refactored on, observes , property and bind, And as @locks suggested, I will make another PR dedicated to refactoring the properties to use the new function definition syntax { foo() {} }
@teddyzeenny Please let me know what do you think, and if you have any notes. Thanks in advance.

@@ -1,27 +1,28 @@
import BasicAdapter from "./basic";
import Ember from 'ember';
const { on } = Ember;

export default BasicAdapter.extend({
name: 'bookmarklet',

inspectedWindow: function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

computed(

@teddyzeenny
Copy link
Contributor

@Mawaheb Nice work, this is almost ready! Left some comments. Leaving the new method definition syntax to another PR is a good idea.

@Mawaheb Mawaheb force-pushed the useArrowFunctions branch from c401fb3 to edc1a58 Compare May 27, 2015 19:29
@Mawaheb
Copy link
Contributor Author

Mawaheb commented May 27, 2015

@teddyzeenny thank you for the feedback, I modified the file accordingly :), Further notes, suggestions are always welcome.

- WIP, more refactoring

- Minor edits.

- Refactor the remaning properties.
@Mawaheb Mawaheb force-pushed the useArrowFunctions branch from edc1a58 to 5d27b03 Compare May 28, 2015 11:23
@Mawaheb
Copy link
Contributor Author

Mawaheb commented May 28, 2015

Please let me know If I did this one right.

And I couldn't figure out how to re-factor this one because it keeps erroring when changed.

@teddyzeenny
Copy link
Contributor

Looks good! @Mawaheb that's how I would handle both cases.

teddyzeenny added a commit that referenced this pull request May 28, 2015
@teddyzeenny teddyzeenny merged commit 43b479a into emberjs:master May 28, 2015
@teddyzeenny teddyzeenny mentioned this pull request Jun 3, 2015
14 tasks
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.

3 participants