import { render } from "react-dom" ; import { ToastContainer } from "./container/container" ; import { ToastType , toastTypes } from "./type/type" ; export * from "./pane/pane" ; export type { ToastType } ; const inited = { current : false } ; const init = async ( resolve ) : Promise < void > => { const element = document . createElement ( "div" ) ; document . body . append ( element ) ; render ( < ToastContainer />, element); await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ; inited . current = true ; resolve ( element ) ; } ; export const toast = async ( type , message ) : Promise < void > => { if ( inited . current === false ) await new Promise ( init ) ; type . handler ( message ) ; } ; toast . types = toastTypes ;