1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-24 16:36:46 +00:00
bramw_baserow/web-frontend/modules/core/plugins/ensureRender.js

15 lines
465 B
JavaScript

import Vue from 'vue'
import flushPromises from 'flush-promises'
export default function (context, inject) {
const ensureRender = async () => {
// Ensure the dom is up to date
await Vue.nextTick()
// Wait until the browser has had a chance to repaint the UI
await new Promise((resolve) => requestAnimationFrame(resolve))
// And purge all promises created in the meantime
await flushPromises()
}
inject('ensureRender', ensureRender)
}