History

Fix viewTree debug function

Thibaut Courouble committed 10 years ago

Commit eac1ec71 parent 0970a441 file · +8 −5Browse files

Unified · Split

assets/javascripts/debug.js.coffee+8−5
@@ -70,13 +70,16 @@ app.Searcher.prototype = _proto · 69 unmodified lines
70# View tree70# View tree
71#71#
72 72
73@viewTree = (view = app.document, level = 0) ->73@viewTree = (view = app.document, level = 0, visited = []) ->
74 console.log "%c #{Array(level + 1).join(' ')}#{view.constructor.name}: #{view.activated}",74 return if visited.indexOf(view) >= 0
75 visited.push(view)
76
77 console.log "%c #{Array(level + 1).join(' ')}#{view.constructor.name}: #{!!view.activated}",
75 'color:' + (view.activated and 'green' or 'red')78 'color:' + (view.activated and 'green' or 'red')
76 79
77 for key, value of view when key isnt 'view' and value80 for own key, value of view when key isnt 'view' and value
78 if typeof value is 'object' and value.setupElement81 if typeof value is 'object' and value.setupElement
79 @viewTree(value, level + 1)82 @viewTree(value, level + 1, visited)
80 else if value.constructor.toString().match(/Object\(\)/)83 else if value.constructor.toString().match(/Object\(\)/)
81 @viewTree(v, level + 1) for k, v of value when value and typeof value is 'object' and value.setupElement84 @viewTree(v, level + 1, visited) for own k, v of value when v and typeof v is 'object' and v.setupElement
82 return85 return

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t