History

Rename .js.js to .js

Simon Legner committed 2 years ago

Commit 6b335fb1 parent 5eaad642 files · +0 −0Browse files

Showing the changes to assets/javascripts/debug.js (1 of 2 files). Show all

Unified · Split

assets/javascripts/debug.js+112−0
@@ -0,0 +1,112 @@
1+// TODO: This file was created by bulk-decaffeinate.
2+// Sanity-check the conversion and remove this comment.
3+/*
4+ * decaffeinate suggestions:
5+ * DS102: Remove unnecessary code created because of implicit returns
6+ * DS203: Remove `|| {}` from converted for-own loops
7+ * DS207: Consider shorter variations of null checks
8+ * DS208: Avoid top-level this
9+ * DS209: Avoid top-level return
10+ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
11+ */
12+if (!(typeof console !== 'undefined' && console !== null ? console.time : undefined) || !console.groupCollapsed) { return; }
13+
14+//
15+// App
16+//
17+
18+const _init = app.init;
19+app.init = function() {
20+ console.time('Init');
21+ _init.call(app);
22+ console.timeEnd('Init');
23+ return console.time('Load');
24+};
25+
26+const _start = app.start;
27+app.start = function() {
28+ console.timeEnd('Load');
29+ console.time('Start');
30+ _start.call(app, ...arguments);
31+ return console.timeEnd('Start');
32+};
33+
34+//
35+// Searcher
36+//
37+
38+const _super = app.Searcher;
39+const _proto = app.Searcher.prototype;
40+
41+app.Searcher = function() {
42+ _super.apply(this, arguments);
43+
44+ const _setup = this.setup.bind(this);
45+ this.setup = function() {
46+ console.groupCollapsed(`Search: ${this.query}`);
47+ console.time('Total');
48+ return _setup();
49+ };
50+
51+ const _match = this.match.bind(this);
52+ this.match = () => {
53+ if (this.matcher) { console.timeEnd(this.matcher.name); }
54+ return _match();
55+ };
56+
57+ const _setupMatcher = this.setupMatcher.bind(this);
58+ this.setupMatcher = function() {
59+ console.time(this.matcher.name);
60+ return _setupMatcher();
61+ };
62+
63+ const _end = this.end.bind(this);
64+ this.end = function() {
65+ console.log(`Results: ${this.totalResults}`);
66+ console.timeEnd('Total');
67+ console.groupEnd();
68+ return _end();
69+ };
70+
71+ const _kill = this.kill.bind(this);
72+ this.kill = function() {
73+ if (this.timeout) {
74+ if (this.matcher) { console.timeEnd(this.matcher.name); }
75+ console.groupEnd();
76+ console.timeEnd('Total');
77+ console.warn('Killed');
78+ }
79+ return _kill();
80+ };
81+
82+};
83+
84+$.extend(app.Searcher, _super);
85+_proto.constructor = app.Searcher;
86+app.Searcher.prototype = _proto;
87+
88+//
89+// View tree
90+//
91+
92+this.viewTree = function(view, level, visited) {
93+ if (view == null) { view = app.document; }
94+ if (level == null) { level = 0; }
95+ if (visited == null) { visited = []; }
96+ if (visited.indexOf(view) >= 0) { return; }
97+ visited.push(view);
98+
99+ console.log(`%c ${Array(level + 1).join(' ')}${view.constructor.name}: ${!!view.activated}`,
100+ 'color:' + ((view.activated && 'green') || 'red'));
101+
102+ for (var key of Object.keys(view || {})) {
103+ var value = view[key];
104+ if ((key !== 'view') && value) {
105+ if ((typeof value === 'object') && value.setupElement) {
106+ this.viewTree(value, level + 1, visited);
107+ } else if (value.constructor.toString().match(/Object\(\)/)) {
108+ for (var k of Object.keys(value || {})) { var v = value[k]; if (v && (typeof v === 'object') && v.setupElement) { this.viewTree(v, level + 1, visited); } }
109+ }
110+ }
111+ }
112+};

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