UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

21 lines (20 loc) 645 B
export class PromiseUtils { _promise; _resolve; _reject; constructor() { this._promise = new Promise((resolve, reject) => { this._resolve = resolve; this._reject = reject; }); } resolveAfter = (ms) => { setTimeout(this._resolve, ms); return this._promise; }; get promise() { return this._promise; } get resolve() { return this._resolve; } get reject() { return this._reject; } static timeoutMs = (ms) => (new PromiseUtils()).resolveAfter(ms); static timeoutSecond = (seconds) => PromiseUtils.timeoutMs(seconds * 1000); }