mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Speed up search and sidebar rendering using requestAnimationFrame
This commit is contained in:
parent
39cc1d3cba
commit
b944227f95
2 changed files with 9 additions and 1 deletions
|
@ -278,6 +278,12 @@ $.classify = (string) ->
|
|||
string[i] = substr[0].toUpperCase() + substr[1..]
|
||||
string.join('')
|
||||
|
||||
$.framify = (fn, obj) ->
|
||||
if requestAnimationFrame
|
||||
(args...) -> requestAnimationFrame(fn.bind(obj, args...))
|
||||
else
|
||||
fn
|
||||
|
||||
#
|
||||
# Miscellaneous
|
||||
#
|
||||
|
|
|
@ -12,7 +12,9 @@ class app.views.ListFocus extends app.View
|
|||
superEnter: 'onSuperEnter'
|
||||
escape: 'blur'
|
||||
|
||||
constructor: (@el) -> super
|
||||
constructor: (@el) ->
|
||||
super
|
||||
@focus = $.framify(@focus, @)
|
||||
|
||||
focus: (el) ->
|
||||
if el and not el.classList.contains @constructor.activeClass
|
||||
|
|
Loading…
Reference in a new issue