History

Speed up search and sidebar rendering using requestAnimationFrame

Thibaut Courouble committed 10 years ago

Commit b9442271 parent 39cc1d32 files · +9 −1Browse files

Unified · Split

2 files
  1. assets/javascripts/lib/util.coffee +6 −0
  2. assets/javascripts/views/list/list_focus.coffee +3 −1
assets/javascripts/lib/util.coffee+6−0
@@ -278,6 +278,12 @@ $.classify = (string) -> · 277 unmodified lines
278 string[i] = substr[0].toUpperCase() + substr[1..]278 string[i] = substr[0].toUpperCase() + substr[1..]
279 string.join('')279 string.join('')
280 280
281$.framify = (fn, obj) ->
282 if requestAnimationFrame
283 (args...) -> requestAnimationFrame(fn.bind(obj, args...))
284 else
285 fn
286
281#287#
282# Miscellaneous288# Miscellaneous
283#289#
assets/javascripts/views/list/list_focus.coffee+3−1
@@ -12,7 +12,9 @@ class app.views.ListFocus extends app.View · 11 unmodified lines
12 superEnter: 'onSuperEnter'12 superEnter: 'onSuperEnter'
13 escape: 'blur'13 escape: 'blur'
14 14
15 constructor: (@el) -> super15 constructor: (@el) ->
16 super
17 @focus = $.framify(@focus, @)
16 18
17 focus: (el) ->19 focus: (el) ->
18 if el and not el.classList.contains @constructor.activeClass20 if el and not el.classList.contains @constructor.activeClass