       appBuildNum: @appOptions.appBuildNum or ""
 
     @newFileOpensInNewTab = if @appOptions.ui?.hasOwnProperty('newFileOpensInNewTab') then @appOptions.ui.newFileOpensInNewTab else true
+
+    @_startPostMessageListener()
 
   setProviderOptions: (name, newOptions) ->
     for provider in @state.availableProviders

      window.location.hash    # leave it alone
    else ""

module.exports =
  CloudFileManagerClientEvent: CloudFileManagerClientEvent
  CloudFileManagerClient: CloudFileManagerClient

      dirty: isDirty
      saved: @state.saved and not isDirty

  shouldAutoSave: =>
    @state.dirty and
      not @state.metadata?.autoSaveDisabled and
      not @isSaveInProgress() and
      @state.metadata?.provider?.can 'resave', @state.metadata

  autoSave: (interval) ->
    if @_autoSaveInterval
      clearInterval @_autoSaveInterval

    # in case the caller uses milliseconds
    if interval > 1000
      interval = Math.round(interval / 1000)
    if interval > 0
      @_autoSaveInterval = setInterval (=> @save() if @shouldAutoSave()), (interval * 1000)

  isAutoSaving: ->
    @_autoSaveInterval?
