Sha256: 0a1e68c032fb5f45ae6016a4a8f654d34a12e673209e8bbc982375654cfd95d0

Contents?: true

Size: 703 Bytes

Versions: 23

Compression:

Stored size: 703 Bytes

Contents

class App.Services.NotificationCenter
  receivedSignal: (data) ->
    switch data.signal
      when 'ping'
        this._pingSignal()
      when 'message'
        this._messageSignal data

  _pingSignal: ->
    return if App.Env.namespaceController.constructor isnt App.Controllers.User
    alert 'Ping!'

  _messageSignal: (data) ->
    return if not view = this._getRoomView()
    view.receivedMessage data.message, data.author

  _getRoomView: ->
    return false if App.Env.namespaceController.constructor isnt App.Controllers.User
    return false if App.Env.controller.constructor isnt App.Controllers.User.Rooms
    return false if App.Env.action isnt 'show'
    App.Env.controller.getView 'show'

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
loco-rails-1.3.2 test/dummy/app/assets/javascripts/services/notification_center.coffee
loco-rails-1.3.1 test/dummy/app/assets/javascripts/services/notification_center.coffee
loco-rails-1.3.0 test/dummy/app/assets/javascripts/services/notification_center.coffee