You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/release/tutorial/part-2/ember-data.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,17 +334,22 @@ Let's start customizing the things that didn't work for us by default. Specifica
334
334
335
335
The first thing we want to do is have our builder respect a configurable default host and/or namespace. Adding a namespace prefix happens to be pretty common across Ember apps, so EmberData provides a global config mechanism for host and namespace. Typically you will want to do this either in your store file or app file.
Let's imagine a component which just logs the names of its arguments when it is first constructed. First, we must define the [Signature][] and pass it into our component, then we can use the `Args` member in our Signature to set the type of `args` in the constructor:
Notice that we have to start by calling `super` with `owner` and `args`. This may be a bit different from what you're used to in Ember or other frameworks, but is normal for sub-classes in TypeScript today. If the compiler just accepted any `...arguments`, a lot of potentially _very_ unsafe invocations would go through. So, instead of using `...arguments`, we explicitly pass the _specific_ arguments and make sure their types match up with what the super-class expects.
106
107
107
-
The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `unknown` because this is a detail we explicitly _don't_ need to know about. The `args` are the `Args` from the Signature we defined.
108
+
The types for `owner` here and `args` line up with what the `constructor` for Glimmer components expects. The `owner` is specified as `Owner`, imported from the `@ember/owner` module. The `args` are the `Args` from the Signature we defined.
108
109
109
110
Additionally, the types of the arguments passed to subclassed methods will _not_ autocomplete as you may expect. This is because in JavaScript, a subclass may legally override a superclass method to accept different arguments. Ember's lifecycle hooks, however, are called by the framework itself, and thus the arguments and return type should always match the superclass. Unfortunately, TypeScript does not and _cannot_ know that, so we have to provide the types directly.
Copy file name to clipboardExpand all lines: guides/v6.3.0/contributing/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ At the top of the page (for the package, method, or class), you will find the wo
31
31
32
32
You can open the link to find a comment block. Make a pull request to update the comment block. The API Guides may take a few weeks to update while the future release is finalized.
33
33
34
-
Here is an example of updating a method. At the top of the section for [`store.createRecord()`](https://api.emberjs.com/ember-data/5.4.0/classes/Store/methods/createRecord?anchor=createRecord), you can find the words "Defined in."
34
+
Here is an example of updating a method. At the top of the section for [`store.createRecord()`](https://api.emberjs.com/ember-data/5.3.12/classes/Store/methods/createRecord?anchor=createRecord), you can find the words "Defined in."
35
35
36
36
Next to the words is, once again, the link to the source code [`ds-model-store.ts`](https://github.com/emberjs/data/blob/master/packages/store/addon/-private/system/ds-model-store.ts).
At this point, you can either persist your changes via `save()` or you can roll back your changes using [`rollbackAttributes()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/rollbackAttributes?anchor=rollbackAttributes).
78
+
At this point, you can either persist your changes via `save()` or you can roll back your changes using [`rollbackAttributes()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/rollbackAttributes?anchor=rollbackAttributes).
79
79
80
80
```javascript
81
81
person.hasDirtyAttributes; // => true
@@ -105,7 +105,7 @@ the errors from saving a blog post in your template:
a promise, which makes it easy to asynchronously handle success and failure
110
110
scenarios. Here's a common pattern:
111
111
@@ -126,10 +126,10 @@ try {
126
126
127
127
## Deleting Records
128
128
129
-
Deleting records is as straightforward as creating records. Call [`deleteRecord()`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/deleteRecord?anchor=deleteRecord)
129
+
Deleting records is as straightforward as creating records. Call [`deleteRecord()`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/deleteRecord?anchor=deleteRecord)
130
130
on any instance of `Model`. This flags the record as `isDeleted`. The
131
131
deletion can then be persisted using `save()`. Alternatively, you can use
132
-
the [`destroyRecord`](https://api.emberjs.com/ember-data/5.4.0/classes/Model/methods/destroyRecord?anchor=destroyRecord) method to delete and persist at the same time.
132
+
the [`destroyRecord`](https://api.emberjs.com/ember-data/5.3.12/classes/Model/methods/destroyRecord?anchor=destroyRecord) method to delete and persist at the same time.
0 commit comments