Sha256: afb676fed21fc8b30c426a7c4123a0a6498d3a32bd6d93cfc2a9b399c55ee5ca

Contents?: true

Size: 954 Bytes

Versions: 3

Compression:

Stored size: 954 Bytes

Contents

Lanes.View.TimedHighlight = {

    cssClass: 'highlighted'
    displayLength: 2000
    current: null,

    cancelCurrent: ->
        return unless @current
        @current.el.removeClass(@cssClass)
        clearTimeout(@current.timeout)
        @current = null

    setTimeout: (timeout)->
        @current.timeout = _.delay( =>
            @current.el.trigger("highlight-hide")
            @cancelCurrent()
        ,timeout)

    move: (el)->
        return unless @current
        @current.el.removeClass(@cssClass)
        @current.el = el
        @current.el.addClass(@cssClass)

    on: (view, timeout=@displayLength)->
        view.$el.addClass(@cssClass)
        @current = { el: view.$el }
        @current.el.trigger("highlight-show")
        this.setTimeout(timeout)

    reset:(timeout)->
        clearTimeout(@current.timeout)
        this.setTimeout(timeout)

    remove: ->
        clearTimeout(@current.timeout)
        @current = null
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.0.3 client/javascripts/view/TimedHighlight.coffee
lanes-0.0.2 client/javascripts/view/TimedHighlight.coffee
lanes-0.0.1 client/javascripts/view/TimedHighlight.coffee