import { h, Component } from 'preact'; import Navigation from '../navigation'; import "./routing.scss" export class Router extends Component<{}, { next?: JSX.Element, current: JSX.Element }> { mounted: HTMLDivElement = undefined; constructor(props) { super(props); this.onChange = this.onChange.bind(this); this.state = { current: Navigation.page.page, next: undefined } } componentWillMount() { Navigation.pageObservable.subscribe(this.onChange) } componentWillUnmount() { Navigation.pageObservable.unsubscribe(this.onChange) } onChange(page: JSX.Element) { this.setState({ next: page, current: this.state.next || this.state.current }); } render() { let overlay; if (this.state.next) { overlay =
} return } }