Skip to content

Commit 2754944

Browse files
Merge pull request #1136 from ozywuli/main-docs-typo-fixes
docs: Fixes a few typos in DOCS.md
2 parents 89306e8 + 4c4f2fb commit 2754944

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

DOCS.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const ArgUsingResource = (someArg) => {
5454

5555
#### Reactivity
5656

57-
function-based resources are _implicitly_ reactive,
58-
in that there is no ceramony required by the consumer to make them reactive
57+
Function-based resources are _implicitly_ reactive,
58+
in that there is no ceremony required by the consumer to make them reactive
5959
or update in response to changes in reactive source-data.
6060

6161
For example, consider a resource that doubles a number (this is over engineered, and you wouldn't want a resource for doubling a number)
@@ -188,7 +188,7 @@ But this is not feature-complete! We still need to handle cleanup to prevent mem
188188
- setInterval(() => (time.current = new Date()), 1_000);
189189
+ let interval = setInterval(() => (time.current = new Date()), 1_000);
190190
+
191-
+ on.cleanup(() => clearInteral(interval))
191+
+ on.cleanup(() => clearInterval(interval))
192192

193193
return time.current;
194194
```
@@ -197,7 +197,7 @@ Now when the `resource` updates or is torn down, won't leave a bunch of `setInte
197197

198198
Lastly, adding in locale-aware formatting with [`Intl.DateTimeFormat`][mdn-DateTimeFormat].
199199
```diff
200-
on.cleanup(() => clearInteral(interval))
200+
on.cleanup(() => clearInterval(interval))
201201

202202
- return time.current;
203203
+ return new Intl.DateTimeFormat('en-US', {
@@ -210,7 +210,7 @@ Lastly, adding in locale-aware formatting with [`Intl.DateTimeFormat`][mdn-DateT
210210

211211

212212
However, there is a goofy behavior with this implementation.
213-
By accessing `time.current`, we end up consuming tracaked data within the `resource`
213+
By accessing `time.current`, we end up consuming tracked data within the `resource`
214214
callback function. When `setInterval` updates `time.current`, the reactivity system
215215
detects that "tracked data that was consumed in the `resource` callback has changed,
216216
and must re-evaluate".
@@ -223,7 +223,7 @@ To solve this, we need to enclose access to the tracked data via an arrow functi
223223
let time = new TrackedObject({ current: new Date() });
224224
let interval = setInterval(() => (time.current = new Date()), 1_000);
225225

226-
on.cleanup(() => clearInteral(interval))
226+
on.cleanup(() => clearInterval(interval))
227227

228228
- return new Intl.DateTimeFormat('en-US', { /* ... ✂️ ...*/ });
229229
+ let formatter = new Intl.DateTimeFormat('en-US', { /* ... ✂️ ...*/ });
@@ -243,7 +243,7 @@ function Clock(locale = 'en-US') {
243243
let time = new TrackedObject({ current: new Date() });
244244
let interval = setInterval(() => (time.current = new Date()), 1_000);
245245

246-
on.cleanup(() => clearInteral(interval))
246+
on.cleanup(() => clearInterval(interval))
247247

248248
let formatter = new Intl.DateTimeFormat(locale, { /* ... ✂️ ...*/ });
249249

@@ -265,7 +265,7 @@ function Clock(locale = 'en-US') {
265265
let time = new TrackedObject({ current: new Date() });
266266
let interval = setInterval(() => (time.current = new Date()), 1_000);
267267

268-
on.cleanup(() => clearInteral(interval))
268+
on.cleanup(() => clearInterval(interval))
269269

270270
let formatter = new Intl.DateTimeFormat(locale, { /* ... ✂️ ...*/ });
271271

@@ -283,7 +283,7 @@ resourceFactory(Clock);
283283
</details>
284284

285285
Up until now, all we've needed in the template for these clocks to work is to have `{{clock}}` in our template.
286-
But becasue we now need to pass data to a function, we need to invoke that function. The `resourceFactory` utility handles some framework-wiring so that the `Clock` function can immediately invoke the `resource` function.
286+
But because we now need to pass data to a function, we need to invoke that function. The `resourceFactory` utility handles some framework-wiring so that the `Clock` function can immediately invoke the `resource` function.
287287

288288
```hbs
289289
{{ (Clock 'en-GB') }}
@@ -321,7 +321,7 @@ if (typeof locale === 'function') {
321321
let time = new TrackedObject({ current: new Date() });
322322
let interval = setInterval(() => (time.current = new Date()), 1_000);
323323

324-
on.cleanup(() => clearInteral(interval))
324+
on.cleanup(() => clearInterval(interval))
325325

326326
let formatter = new Intl.DateTimeFormat(currentLocale, { /* ... ✂️ ...*/ });
327327

@@ -355,4 +355,3 @@ class {
355355
[🔝 back to top](#authoring-resources)
356356

357357
See: Cookbook entry, [`fetch` with `AbortController`](https://github.com/NullVoxPopuli/ember-resources/blob/main/docs/docs/cookbook/fetch-with-AbortController.md#using-resource-1)
358-

0 commit comments

Comments
 (0)