       else
         error "KD.singletons[\"#{singletonName}\"] singleton exists! if you want to override set override param to true]"
         KD.singletons[singletonName]
+      KDObject.emit "singleton.#{singletonName}.registered"
     else
       # log "singleton registered! KD.singletons[\"#{singletonName}\"]"
       KD.singletons[singletonName] = object


  getKDViewInstanceFromDomElement:(domElement)->
    @instances[$(domElement).data("data-id")]


  # for now it is just a short hand method for propagate but in nodejs fashion
  emit: (eventType, args)->
    for subscription in @subscriptions
      if eventType is subscription.KDEventType
        subscription.callback.apply null,args

  propagateEvent: (KDEventType, publishingInstance, value)->
    for subscription in @subscriptions

  @

# Cross-Browser DOM dependencies
window.URL                   = window.URL                   ? window.webkitURL                   ? null
window.BlobBuilder           = window.BlobBuilder           ? window.WebKitBlobBuilder           ? window.MozBlobBuilder           ? null
window.requestFileSystem     = window.requestFileSystem     ? window.webkitRequestFileSystem     ? null
window.requestAnimationFrame = window.requestAnimationFrame ? window.webkitRequestAnimationFrame ? window.mozRequestAnimationFrame ? null

# FIXME: add to utils.coffee
String.prototype.capitalize   = ()-> this.charAt(0).toUpperCase() + this.slice(1)
String.prototype.decapitalize = ()-> this.charAt(0).toLowerCase() + this.slice(1)
String.prototype.trim         = ()-> this.replace(/^\s+|\s+$/g,"")

# KD Global
KD = @KD or {}

@KD = $.extend (KD), do ->

  # private member for tracking z-indexes
  zIndexContexts  = {}
  debugStates     : {}
