Browse code

Zobrazovanie a pametanie si len urciteho poctu historie

Cinan Rakosnik authored on 16/04/2013 at 00:45:04
Showing 1 changed files
... ...
@@ -4,6 +4,8 @@ class Xmpp.Views.Chat.WindowView extends Backbone.View
4 4
   template: JST["backbone/templates/chat/window"]
5 5
   el: $('#conversation-js')
6 6
 
7
+  maxHistoryLength: 20
8
+
7 9
   events:
8 10
     'submit #msg-writer': (e) -> @sendMessage(e)
9 11
 
... ...
@@ -69,5 +71,8 @@ class Xmpp.Views.Chat.WindowView extends Backbone.View
69 69
     @log(messageView)
70 70
 
71 71
   log: (view) ->
72
+    if (@historyStack.length + 1 >= @maxHistoryLength)
73
+      @historyStack = @historyStack.slice(@historyStack.length - @maxHistoryLength + 1)
74
+
72 75
     @historyStack.push(view)
73 76
 #    App.debug @historyStack