An open API service indexing awesome lists of open source software.

https://github.com/markmead/alpinejs-force-next-tick

Alpine JS implementation of the double `requestAnimationFrame` method to force `$nextTick`
https://github.com/markmead/alpinejs-force-next-tick

alpine-js alpinejs alpinejs-plugin nexttick

Last synced: 11 months ago
JSON representation

Alpine JS implementation of the double `requestAnimationFrame` method to force `$nextTick`

Awesome Lists containing this project

README

          

# Alpine JS Force `$nextTick`

Alpine JS implementation of the double `requestAnimationFrame` method to force
`$nextTick`

---

You can find out more about the issue in Vue here -
https://github.com/vuejs/vue/issues/9200

Vue JS version - https://github.com/twickstrom/vue-force-next-tick

## Install

### With a CDN

```html

```

### With a Package Manager

```shell
yarn add -D alpinejs-force-next-tick

npm install -D alpinejs-force-next-tick
```

```js
import Alpine from 'alpinejs'
import force-next-tick from 'alpinejs-force-next-tick'

Alpine.plugin(force-next-tick)

Alpine.start()
```

## Example

It works the same way as Alpine JS `$nextTick` but uses the double
`requestAnimationFrame` method - https://alpinejs.dev/magics/nextTick

```html

console.log($el.innerText))
"
x-text="firstName"
>

```

Here we are pausing an `async` function until after pending DOM updates. With
this approach an argument is not required.

```html


```

## Stats

![](https://img.shields.io/bundlephobia/min/alpinejs-force-next-tick)
![](https://img.shields.io/npm/v/alpinejs-force-next-tick)
![](https://img.shields.io/npm/dt/alpinejs-force-next-tick)
![](https://img.shields.io/github/license/markmead/alpinejs-force-next-tick)