   catch err
     null
 
+jsonpRegistry = {}
 
 class _KDBSrv extends HTMLElement
   createdCallback: ->

    @hidden = true
    @ws = @wsReq = null
    @wsQueue = []
    console.log "kdb-srv inited: srvType:#{@srvType}, target:#{@target}, prefix:#{@qPrefix}, rType:#{@rType}" if @debug
    if @target
      @target = (document.querySelector "[k-id='#{@target}']") || @target
  runQuery: (q,cb) ->
    (cb = (r,e) -> null) unless cb
    return @sendHTTP q,cb if @srvType is 'http'
    @sendWS q,cb
  sendWS: (qq,clb) ->
    @wsQueue.push q:qq, cb:clb

    @debug = @attributes['debug']?.textContent || null
    @escHtml = (@attributes['k-escape-html']?.textContent || 'true') == 'true'
    @kConfig = @attributes['k-config']?.textContent
    @kClass = @attributes['k-class']?.textContent || "kdb-table"
    @kStyle = @attributes['k-style']?.textContent || ""
    @kSearch = (@attributes['k-search']?.textContent || 'false') == 'true'
    @inited = false
    if @kLib is 'jsgrid'
      @kCont = document.createElement 'div'
      cont = document.createElement 'div'
      cont.className = @kClass
      cont.style.cssText = @kStyle
      cont.appendChild @kCont
      this.appendChild cont
    console.log "kdb-table: srv: #{@srv}, query: #{@query}, lib:#{@kLib}" if @debug
