Sha256: c0c6848bcb329b355cf208c553aa85c3e111e8b783ee70ff8811c7d6bbd137f2

Contents?: true

Size: 804 Bytes

Versions: 9

Compression:

Stored size: 804 Bytes

Contents

#= require joosy/joosy

#
# Widgets manipulation
#
Joosy.helpers 'Application', ->

  #
  # Injects widget
  # 
  # @param [String] tag             Tag name to use a widget container
  # @param [Object] options         Tag attributes
  # @param [Joosy.Widget] widget    Class or instance of {Joosy.Widget} to register
  # @param [Function] widget        Function returning class or instance of {Joosy.Widget}
  #
  # @note Widget instance will be generated on the next asynchronous tick
  #   so make sure to append resulting string to DOM synchronously
  #
  @widget = (tag, options, widget) ->
    unless widget?
      widget  = options
      options = {}

    options.id = Joosy.uid()

    @__renderer.setTimeout 0, =>
      @__renderer.registerWidget($('#'+options.id), widget)

    @tag tag, options

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
joosy-1.2.0.alpha.59 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.58 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.57 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.56 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.55 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.54 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.53 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.52 source/joosy/helpers/widgets.coffee
joosy-1.2.0.alpha.51 source/joosy/helpers/widgets.coffee