Last active
October 14, 2020 13:46
-
-
Save ljmotta/deef6a2ebabd274a605da0a094e9cb95 to your computer and use it in GitHub Desktop.
TodoListEnvelope Envelope View Delegate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TodoListEnvelopeView, TodoListEnvelopeViewApi } from "./TodoListEnvelopeView"; | |
export function init(args: { container: HTMLElement; bus: EnvelopeBus }) { | |
// ... | |
const envelopeViewDelegate = async () => { | |
const ref = React.createRef<TodoListEnvelopeViewApi>(); | |
return new Promise<() => TodoListEnvelopeViewApi>((res) => | |
ReactDOM.render(<TodoListEnvelopeView ref={ref} channelApi={envelope.channelApi} />, args.container, () => | |
res(() => ref.current!) | |
) | |
); | |
}; | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment