 path = require 'path'
 fs = require 'fs-plus'
-{File, CompositeDisposable} = require 'atom'
+{Emitter, File, CompositeDisposable} = require 'atom'
 
 # Editor model for an image file
 module.exports =

    @file = new File(filePath)
    @uri = "file://" + encodeURI(filePath.replace(/\\/g, '/')).replace(/#/g, '%23').replace(/\?/g, '%3F')
    @subscriptions = new CompositeDisposable()

  serialize: ->
    {filePath: @getPath(), deserializer: @constructor.name}

  getViewClass: ->
    require './image-editor-view'

  # Register a callback for when the image file changes
  onDidChange: (callback) ->

  # Returns a {Boolean}.
  isEqual: (other) ->
    other instanceof ImageEditor and @getURI() is other.getURI()

  # Essential: Invoke the given callback when the editor is destroyed.
  #
  # * `callback` {Function} to be called when the editor is destroyed.
  #
  # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
  onDidDestroy: (callback) ->
    @emitter.on 'did-destroy', callback
