 
   componentDidMount: ->
     @props.target.listen 'change', @handleTargetChange
+    addEventListener 'beforeunload', @handlePageExit
 
   componentWillReceiveProps: (nextProps) ->
     @props.target.stopListening 'change', @handleTargetChange


  getDefaultProps: ->
    target: apiClient
    style:
      background: 'rgba(0, 0, 0, 0.5)'
      borderRadius: '0 0 0.3em 0.3em'

        </span>
      </span>
    </span>

  handlePageExit: (e) ->
    unless @state.writes is 0
      e.returnValue = @props.confirmation
      @props.confirmation
