import { Component, ComponentProps, Event, console, setTimeout, clearTimeout } from "waft"; import { JSON, JSONObject, JSONString } from "waft-json"; import { refs } from "waft-ui-common"; let time: i32; export class SideBar extends Component { constructor(props: ComponentProps) { super(props); } willMount(props: JSONObject): void { super.willMount(props); if (props.has('ref')) { const ref = (props.get('ref') as JSONString).toString() refs.set(ref, this); } } show(): void { const n = true const o = new JSONObject() o.set('show', n) o.set('showMask', n) this.setState(o) } handleCloseClick(event: Event):void { const n = false const o = new JSONObject() o.set('show', n) this.setState(o) time = setTimeout((_, target) => { if (target) { const self = target as SideBar; const state = new JSONObject(); state.set('showMask', false) self.setState(state); } }, 300, this); } didUnmount(): void{ clearTimeout(time); } }