 
   ############################################################## wInit
 
+  constructor: (opts)->
+    super
+    this._normalizePartials(opts)
+
   wInit: (parent, name) ->
-    this._normalize_autorefresh()
     super
   
   ############################################################## Public API

    call = render(text)
    call += "()" unless call[call.length - 1] == ')'
    call = "function(){ this.#{call}; }"
    call = "$.wCall('#{this.wQid()}/..', #{call});"
    call

  mustacheRender: =>
	  tpl = this.template()
	  callRenderer = this.wCallRenderer      
	  data = $.extend({}, this.wParent(), {wCall: -> callRenderer}, this.renderData())
	  Mustache.to_html(tpl, data)

  ############################################################## Private API

  _normalize_autorefresh: ->
    ar = @options['autorefresh']
    ar = [] unless ar?
    ar = [ ar ] if !(ar instanceof Array)
    for l in ar
      if (typeof(l) == "string")
        this.wListen(l, this.refresh) 
      else
        l.listen(this.refresh)
    @options['autorefresh'] = ar


  defaults:
    url: (v)-> 
      v.renderScope().wQid() + '/' + v.wName()
    selector: (v)->
      "#" + v.wName()
    template: (v)->
      v._template ?= $.ajax(url: v.url(), async: false).responseText
    handler:
      'server'
    renderScope: (v)->
	    v.wParent()
    renderData: {}
    partials: []
    render: (v)->
      switch v.handler()
        when 'server'
