 FileTypeNotSupportedView = require './not-supported-view'
+Observer = require './observer'
 
 jsbeautify = (require 'js-beautify').js_beautify
 


  subscribeToEvents: (state) ->
    if atom.config.get('jsformat.format_on_save') ? @configDefaults['format_on_save']
      @editorCreationSubscription = atom.workspaceView.eachEditorView (editorView) =>
        editor = editorView.getEditor()
        grammar = editor.getGrammar().scopeName

        if grammar is 'source.js' or grammar is 'source.json'

            delete @editorCloseSubscriptions[editor.id]
    else
      if @editorCreationSubscription
        @editorCreationSubscription.dispose()
        @editorCreationSubscription = null

        for subscriptionId, subscription of @editorSaveSubscriptions
