Skip to content

Commit

Permalink
Add description to the init event
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cetinkaya committed Feb 19, 2020
1 parent 9614e3f commit 142bf73
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ embla.destroy()
const embla = EmblaCarousel(emblaNode, options)

const onInitCallback = () => {
console.log('The carousel has just been initialized.')
console.log('The carousel is ready to rock.')
}

embla.on('init', onInitCallback)
Expand Down Expand Up @@ -1793,11 +1793,17 @@ embla.on('scroll', () => {

<details>
<summary>
Under construction...
Fire your callback when the carousel mounts.
</summary>
<hr>
<div>
Under construction...
This event fires the given callback when the carousel has initialised and its
<a href="#api">
<code>API</code>
</a> is ready to use. Note that the init event only fires once upon the first initialisation and won't trigger when invoking
<a href="#changeOptions">
<code>changeOptions</code>
</a> or similar.
</div>
<br>
<div>
Expand All @@ -1806,7 +1812,7 @@ embla.on('scroll', () => {
</a>
&nbsp;
<a href="#">
<code>CodeSandbox</code>
<code>CodeSandbox (upcoming)</code>
</a>
</div>
<br>
Expand All @@ -1816,6 +1822,12 @@ embla.on('scroll', () => {

```javascript
const embla = EmblaCarousel(emblaNode, options)

const onInitCallback = () => {
console.log('The carousel is ready to rock.')
})

embla.on('init', onInitCallback)
```

<hr>
Expand Down

0 comments on commit 142bf73

Please sign in to comment.