import * as React from 'react'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import * as cli from '../cli'; import { CommandShell, t, MyComponent, ObjectView, Hr } from '../common'; export type ITestProps = {}; export class Test extends React.PureComponent { public state: t.ITestState = {}; private unmounted$ = new Subject(); private state$ = new Subject>(); private cli: t.ICommandState = cli.init({ state$: this.state$ }); /** * [Lifecycle] */ public componentWillMount() { const state$ = this.state$.pipe(takeUntil(this.unmounted$)); state$.subscribe(e => this.setState(e)); } public componentWillUnmount() { this.unmounted$.next(); this.unmounted$.complete(); } /** * [Render] */ public render() { return (

); } }