Skip to content

Commit f669b67

Browse files
chrisrngJen Weber
authored andcommitted
update intro to objects to be beginner-friendly (#186)
* docs(Objects in Ember): update intro to objects closes #155 * docs(Objects in Ember): update some wording * docs(Objects in Ember): update obvs CP wording * docs(Objects in Ember): expand on binding system * docs(Objects in Ember): relative vs absolute urls * docs(Objects in Ember): fix relative vs absolute
1 parent fa22969 commit f669b67

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

guides/v3.4.0/object-model/index.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
You'll notice standard JavaScript class patterns and the new ES2015
2-
classes aren't widely used in Ember. Plain objects can still be found,
3-
and sometimes they're referred to as "hashes".
1+
One of the first things you'll notice when you generate JavaScript files in Ember is that most of the code you will write goes inside of an object. While an Ember Object might look a lot like an ES2015 JavaScript class, it has some special properties.
42

5-
JavaScript objects don't support the observation of property value changes.
6-
Consequently, if an object is going to participate in Ember's binding
7-
system you may see an `Ember.Object` instead of a plain object.
3+
### Introducing: Ember Objects
84

9-
[Ember.Object](https://www.emberjs.com/api/ember/release/modules/@ember%2Fobject) also provides a class system, supporting features like mixins
10-
and constructor methods. Some features in Ember's object model are not present in
11-
JavaScript classes or common patterns, but all are aligned as much as possible
12-
with the language and proposed additions.
5+
The [Ember Object](https://www.emberjs.com/api/ember/release/classes/EmberObject) class extends plain JavaScript objects to provide core framework functions such as participating in Ember's [binding system](../object-model/bindings/) or how changes to an object automatically trigger updates to the user interface.
136

14-
Ember also extends the JavaScript `Array` prototype with its
15-
[Ember.Enumerable](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable) interface to provide change observation for arrays.
7+
Most objects in Ember, including Routes, Models, Services, Mixins, Controllers, and Components extend the `EmberObject` class.
168

17-
Finally, Ember extends the `String` prototype with a few [formatting and
18-
localization methods](https://www.emberjs.com/api/ember/release/classes/String).
9+
### Why Ember Objects?
10+
11+
The most important reason is that an Ember Object can be watched for changes – or _observed_. For example, being [observable](https://www.emberjs.com/api/ember/release/classes/Observable) is important for [computed properties](../object-model/computed-properties/). It is one of the fundamental ways that models, controllers and views communicate with each other in an Ember application.
12+
13+
### More on Ember Objects
14+
15+
The [@ember/object](https://www.emberjs.com/api/ember/release/modules/@ember%2Fobject) package also provides a class system, supporting features like mixins and constructor methods, and being observable.
16+
17+
Some features in Ember's object model are not present in JavaScript classes or common patterns, but all are aligned as much as possible with the language and proposed additions.
18+
19+
Ember also extends the JavaScript `Array` prototype with its [@ember/enumerable](https://emberjs.com/api/ember/release/classes/Enumerable) interface to provide change observation for arrays.
20+
21+
Finally, Ember extends the `String` prototype with a few [formatting and localization methods](https://www.emberjs.com/api/ember/release/classes/String).

0 commit comments

Comments
 (0)