import { WebviewTag } from 'electron'; import React from 'react'; interface IProps { onSuccess: () => void; } export class LoginWebview extends React.Component { private webview: WebviewTag; constructor(props: IProps) { super(props); } componentDidMount() { this.webview = this.refs['webview'] as any; this.webview.addEventListener('did-stop-loading', this.didStopLoading); } didStopLoading = (event: any) => { if ((event.target.src as string).includes('my-account')) { this.props.onSuccess(); } }; render() { return ( ); } }