Showing the changes to assets/javascripts/debug.js.js (1 of 76 files). Show all
Unified · Split
| @@ -0,0 +1,85 @@ | ||
| 1 | +return unless console?.time and console.groupCollapsed | |
| 2 | + | |
| 3 | +# | |
| 4 | +# App | |
| 5 | +# | |
| 6 | + | |
| 7 | +_init = app.init | |
| 8 | +app.init = -> | |
| 9 | + console.time 'Init' | |
| 10 | + _init.call(app) | |
| 11 | + console.timeEnd 'Init' | |
| 12 | + console.time 'Load' | |
| 13 | + | |
| 14 | +_start = app.start | |
| 15 | +app.start = -> | |
| 16 | + console.timeEnd 'Load' | |
| 17 | + console.time 'Start' | |
| 18 | + _start.call(app, arguments...) | |
| 19 | + console.timeEnd 'Start' | |
| 20 | + | |
| 21 | +# | |
| 22 | +# Searcher | |
| 23 | +# | |
| 24 | + | |
| 25 | +_super = app.Searcher | |
| 26 | +_proto = app.Searcher.prototype | |
| 27 | + | |
| 28 | +app.Searcher = -> | |
| 29 | + _super.apply @, arguments | |
| 30 | + | |
| 31 | + _setup = @setup.bind(@) | |
| 32 | + @setup = -> | |
| 33 | + console.groupCollapsed "Search: #{@query}" | |
| 34 | + console.time 'Total' | |
| 35 | + _setup() | |
| 36 | + | |
| 37 | + _match = @match.bind(@) | |
| 38 | + @match = => | |
| 39 | + console.timeEnd @matcher.name if @matcher | |
| 40 | + _match() | |
| 41 | + | |
| 42 | + _setupMatcher = @setupMatcher.bind(@) | |
| 43 | + @setupMatcher = -> | |
| 44 | + console.time @matcher.name | |
| 45 | + _setupMatcher() | |
| 46 | + | |
| 47 | + _end = @end.bind(@) | |
| 48 | + @end = -> | |
| 49 | + console.log "Results: #{@totalResults}" | |
| 50 | + console.timeEnd 'Total' | |
| 51 | + console.groupEnd() | |
| 52 | + _end() | |
| 53 | + | |
| 54 | + _kill = @kill.bind(@) | |
| 55 | + @kill = -> | |
| 56 | + if @timeout | |
| 57 | + console.timeEnd @matcher.name if @matcher | |
| 58 | + console.groupEnd() | |
| 59 | + console.timeEnd 'Total' | |
| 60 | + console.warn 'Killed' | |
| 61 | + _kill() | |
| 62 | + | |
| 63 | + return | |
| 64 | + | |
| 65 | +$.extend(app.Searcher, _super) | |
| 66 | +_proto.constructor = app.Searcher | |
| 67 | +app.Searcher.prototype = _proto | |
| 68 | + | |
| 69 | +# | |
| 70 | +# View tree | |
| 71 | +# | |
| 72 | + | |
| 73 | +@viewTree = (view = app.document, level = 0, visited = []) -> | |
| 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}", | |
| 78 | + 'color:' + (view.activated and 'green' or 'red') | |
| 79 | + | |
| 80 | + for own key, value of view when key isnt 'view' and value | |
| 81 | + if typeof value is 'object' and value.setupElement | |
| 82 | + @viewTree(value, level + 1, visited) | |
| 83 | + else if value.constructor.toString().match(/Object\(\)/) | |
| 84 | + @viewTree(v, level + 1, visited) for own k, v of value when v and typeof v is 'object' and v.setupElement | |
| 85 | + return | |