Skip to content

Commit 11868e5

Browse files
author
Kristján Oddsson
authored
Merge pull request #144 from carlmjohnson/patch-1
Fix typo window.customElements.register → define
2 parents fd0f686 + cdad890 commit 11868e5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/_guide/your-first-component.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Remember! A class name _must_ include at least two CamelCased words (not includi
3939
The `@controller` decorator ties together the various other decorators within Catalyst, plus a few extra conveniences such as automatically registering the element, which saves you writing some boilerplate that you'd otherwise have to write by hand. Specifically the `@controller` decorator:
4040

4141
- Derives a tag name based on your class name, removing the trailing `Element` suffix and lowercasing all capital letters, separating them with a dash.
42-
- Calls `window.customElements.register` with the newly derived tag name and your class.
42+
- Calls `window.customElements.define` with the newly derived tag name and your class.
4343
- Calls `defineObservedAttributes` with the class to add map any `@attr` decorators. See [attrs]({{ site.baseurl }}/guide/attrs) for more on this.
4444
- Injects the following code inside of the `connectedCallback()` function of your class:
4545
- `bind(this)`; ensures that as your element connects it picks up any `data-action` handlers. See [actions]({{ site.baseurl }}/guide/actions) for more on this.
@@ -59,7 +59,7 @@ class HelloWorldElement extends HTMLElement {
5959
}
6060
}
6161
defineObservedAttributes(HelloWorldElement)
62-
window.customElements.register('hello-world', HelloWorldElement)
62+
window.customElements.define('hello-world', HelloWorldElement)
6363
```
6464

6565
Using the `@controller` decorator saves on having to write this boilerplate for each element.

0 commit comments

Comments
 (0)