UNPKG

remix-nlux

Version:

Remix IDE NLUX integration. Remix IDE is the leading IDE for building and deploying smart contracts on Ethereum. NLUX is a JavaScript and React library for building conversational AI experiences.

23 lines (17 loc) 682 B
import {act} from 'react'; export const waitForRenderCycle = async () => new Promise(resolve => { requestAnimationFrame(resolve); }); export const waitForReactRenderCycle = async () => { const animationFramePromise = new Promise(resolve => { requestAnimationFrame(resolve); }); await act(() => animationFramePromise); }; export const waitForMilliseconds = (milliseconds: number) => new Promise(resolve => { setTimeout(resolve, milliseconds); }); export const waitForMdStreamToComplete = (streamLength: number = 20) => new Promise(resolve => { const duration = streamLength * 10; // 10ms wait per character setTimeout(resolve, duration); });