Sha256: 4b3c8dda2453b2bb6dd47e93de1908a71a646246d7abba8c1f9ee67e0b6ca307

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 Bytes

Contents

class TaoModule

  @extend: (obj) ->
    unless obj and typeof obj == 'object'
      throw new Error('TaoModule.extend: param should be an object')

    for key, val of obj when key not in ['included', 'extended']
      @[key] = val

    obj.extended?.call(@)
    @

  @include: (obj) ->
    unless obj and typeof obj == 'object'
      throw new Error('TaoModule.include: param should be an object')

    for key, val of obj when key not in ['included', 'extended']
      @::[key] = val

    obj.included?.call(@)
    @

  constructor: (opts) ->
    @_setOptions opts
    @_init()

  _setOptions: (opts) ->
    @opts = $.extend {}, TaoModule.opts, opts

  _init: ->

  on: (args...) ->
    $(@).on args...

  off: (args...) ->
    $(@).off args...

  trigger: (args...) ->
    $(@).triggerHandler(args...)

  one: (args...) ->
    $(@).one args...

window.TaoModule = TaoModule

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tao_on_rails-0.4.2 lib/assets/javascripts/tao/module.coffee
tao_on_rails-0.4.1 lib/assets/javascripts/tao/module.coffee
tao_on_rails-0.3.0 lib/assets/javascripts/tao/module.coffee