Class: NotificationController

Inherits:
Object
  • Object
show all
Defined in:
lib/bull/notification.rb

Constant Summary collapse

@@ticket =
0

Instance Method Summary collapse

Constructor Details

#initialize(panel, level) ⇒ NotificationController

Returns a new instance of NotificationController.



35
36
37
38
# File 'lib/bull/notification.rb', line 35

def initialize panel, level
  @panel = panel
  @level = level
end

Instance Method Details

#add(msg) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bull/notification.rb', line 40

def add msg
  return if msg[-1] < @level
  id = @@ticket
  @@ticket += 1
  @panel.append id, ['animated fadeIn'] + msg
  $window.after(4) do
    @panel.update id, ['animated fadeOut'] + msg
  end
  $window.after(5) do
    @panel.delete id
  end
end