This repository has been archived by the owner on May 26, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 870
Improve Object Model section #555
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2e59524
add introduction to object model section
michaelrkn 109f5d6
remove stray ember view references
michaelrkn 32b4190
add introduction to classes and instances guide
michaelrkn cc8544d
warn against using bindings and observers on their respective pages
michaelrkn 886a0c4
reorganize enumerable guide
michaelrkn ce88129
add content on observable methods to enumerable guide
michaelrkn d4391f2
remove references to deprecated Ember.Set
michaelrkn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
You'll soon notice that standard JavaScript objects aren't used widely in Ember, | ||
except as key-value pairs (often referred to as _hashes_). This is because | ||
JavaScript objects don't support the ability to observe when an object changes, | ||
which Ember needs to update data throughout an application. | ||
Ember's object model builds on standard JavaScript objects to enable this | ||
functionality, as well as bring several features like mixins and initialization | ||
to make working with them a more pleasant experience. Although these features | ||
aren't available in standard JavaScript, many of them are designed to align with | ||
proposed additions to the ECMAScript standard. | ||
|
||
In addition to bringing its own object model, Ember also extends the built-in | ||
JavaScript `Array` prototype with its Enumerable interface to enable it to | ||
observe changes and provide more features. | ||
|
||
Finally, Ember extends the `String` prototype with a few [formatting and | ||
localization methods](http://emberjs.com/api/classes/Ember.String.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we mention somewhere that prototype extensions are disabled in addons? or that's for the ember-cli addons documentation, or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the goal is to move away from talking about prototype extensions in an effort to get people to also move away from using them #457 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a related but separate issue @HeroicEric, I'm fine with the PR as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@locks I just figured that since this is new content it, it might be better to not add more references to prototype extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My takeaway from #110 was that we are discourage use of Function prototype extensions but were okay with Array prototype extensions, at least for now. If I misunderstood or there's been other discussion since, just let me know!
Re: addons, I think that's a separate story, and should go in the guide for authoring addons when it's written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelrkn I know the goal to eventually move away from extending
Array
but it looks like there is a good amount of work left (emberjs/ember.js#10899) before that will happen. And I do think that part about the arrays is still useful to know because you're likely to run into them with current state of things, so I'm not totally against that part.IMO, the part about
String
prototype extensions is less important to tell them about. I think it would be better to encourage usingEmber.String.foo
whenever possible.That being said, I can always open another issue about this to discuss it further without blocking this PR 😄