UNPKG

reblendjs

Version:

This is build using react way of handling dom but with web components

36 lines (35 loc) 996 B
import { isCallable } from '../../common/utils'; import { Reblend } from '../../internal/Reblend'; //@ReblendComponent function TryCatchError({ children = ((_error) => <>{''}</>), }) { //@ts-ignore this && //@ts-ignore (this.renderingErrorHandler = (e) => { //@ts-ignore this.renderingError = e; //if (!this.stateEffectRunning && this.attached) { //Promise.resolve().then(() => { //@ts-ignore this?.onStateChange(); //}) //} }); function view() { const arr = []; for (const child of children) { if (isCallable(child)) { //@ts-ignore arr.push(child(this.renderingError)); } else { arr.push(child); } } //@ts-ignore this.renderingError = null; return arr; } return <div>{view()}</div>; } export { TryCatchError };