import * as React from 'react';
let titleSet = false;
export class PageTitle extends React.Component {
    componentDidMount() {
        if (titleSet) {
            console.error('more than one PageTitle used at the same time');
        }
        titleSet = true;
        this.updateTitle(this.props.title);
    }
    componentWillReceiveProps(nextProps) {
        this.updateTitle(nextProps.title);
    }
    componentWillUnmount() {
        titleSet = false;
        document.title = 'Sourcegraph';
    }
    render() {
        return null;
    }
    updateTitle(title) {
        document.title = title ? `${title} - Sourcegraph` : 'Sourcegraph';
    }
}
//# sourceMappingURL=PageTitle.js.map