Sha256: cc5cb05ce5d50817703a13ff7ca42837e279923b02fbd819998fe49599081144

Contents?: true

Size: 993 Bytes

Versions: 36

Compression:

Stored size: 993 Bytes

Contents

define 'aura/extensions/widget/napable', ->

  'use strict'

  napable =
    bind: ->
      @sandbox.on "#{@name}.#{@identifier}.sleep", napable.sleep, @
      @sandbox.on "#{@name}.#{@identifier}.wake" , napable.wake , @
    sleep: ->
      @$el.addClass 'asleep'
      @$el.removeClass 'awake'
    wake: ->
      @$el.addClass 'awake'
      @$el.removeClass 'asleep'

  napable_extensions =
    constructor: ->
      napable_extensions["super"].constructor.apply @, arguments
      napable.bind.call @

  # The purpose of this extension is allow parent widget to save
  # memory by sending a sleep command to the child widgets
  (application) ->

    version: '0.1.0'

    initialize: (application) ->
      {core} = application

      # Add support for element removal after stoping widget
      # TODO replace Base.extend inheritance to stampit composition
      core.Widgets.Base = core.Widgets.Base.extend napable_extensions
      napable_extensions.super  = core.Widgets.Base.__super__

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ende-0.4.24 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.23 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.22 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.21 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.16 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.3.13 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.3.12 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.3.11 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.15 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.14 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.13 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.12 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.11 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.10 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.9 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.8 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.7 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.6 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.5 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee
ende-0.4.4 lib/assets/javascripts/aura/extensions/widget/napable.js.coffee