 
   getMeterEl: (index) =>
     uploadMeterSelector = ".candru [data-upload-id=\"#{index}\"] .meter"
-    return this.el.querySelector(uploadMeterSelector)
+    return @el.querySelector(uploadMeterSelector)
 
   getCancelEl: (index) =>
     uploadMeterSelector = ".candru [data-upload-id=\"#{index}\"] .cancel"
-    return this.el.querySelector(uploadMeterSelector)
+    return @el.querySelector(uploadMeterSelector)
 
   createUploadItem: (file, index) =>
     uploadItem = document.createElement('div')

    e.preventDefault()
    e.stopPropagation()

    removeClass(this.el, this.defaults.overClass)

    false

  fileTypeCheck: (file) ->
    acceptedType = false

    for type in this.defaults.allowedTypes
      if type.test(file.type)
        acceptedType = true
        break

noop = ->

# Borrowing the Emitter from dropzone
# https://raw.githubusercontent.com/enyo/dropzone/master/src/dropzone.coffee
class Emitter
  addEventListener: @::on
  on: (event, fn) ->
    @_callbacks = @_callbacks || {}
    # Create namespace for this event
    @_callbacks[event] = [] unless @_callbacks[event]
    @_callbacks[event].push fn
    return @


  emit: (event, args...) ->
    @_callbacks = @_callbacks || {}
    callbacks = @_callbacks[event]

    if callbacks
      callback.apply @, args for callback in callbacks

    return @

  removeListener: @::off
  removeAllListeners: @::off
  removeEventListener: @::off
  off: (event, fn) ->
    if !@_callbacks || arguments.length == 0
      @_callbacks = {}
      return @

    # specific event
    callbacks = @_callbacks[event]
    return @ unless callbacks

    # remove all handlers
    if arguments.length == 1
      delete @_callbacks[event]
      return @

    # remove specific handler
    for callback, i in callbacks
      if callback == fn
        callbacks.splice i, 1
        break

    return @

class window.Candru extends Emitter
  # Define a couple of useful helpers
  extend = (object, properties) ->
    for key, val of properties
