History

Prettier.io

Simon Legner committed 2 years ago

Commit a905bdf1 parent 6b335fb80 files · +13159 −10611Browse files

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

Unified · Split

assets/javascripts/debug.js+58−31
@@ -9,26 +9,33 @@ · 8 unmodified lines
99 * DS209: Avoid top-level return
1010 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
1111 */
12−if (!(typeof console !== 'undefined' && console !== null ? console.time : undefined) || !console.groupCollapsed) { return; }
12+if (
13+ !(typeof console !== "undefined" && console !== null
14+ ? console.time
15+ : undefined) ||
16+ !console.groupCollapsed
17+) {
18+ return;
19+}
1320
1421 //
1522 // App
1623 //
1724
1825 const _init = app.init;
19−app.init = function() {
20− console.time('Init');
26+app.init = function () {
27+ console.time("Init");
2128 _init.call(app);
22− console.timeEnd('Init');
23− return console.time('Load');
29+ console.timeEnd("Init");
30+ return console.time("Load");
2431 };
2532
2633 const _start = app.start;
27−app.start = function() {
28− console.timeEnd('Load');
29− console.time('Start');
34+app.start = function () {
35+ console.timeEnd("Load");
36+ console.time("Start");
3037 _start.call(app, ...arguments);
31− return console.timeEnd('Start');
38+ return console.timeEnd("Start");
3239 };
3340
3441 //
@@ -38,47 +45,50 @@ app.start = function() { · 3 unmodified lines
3845 const _super = app.Searcher;
3946 const _proto = app.Searcher.prototype;
4047
41−app.Searcher = function() {
48+app.Searcher = function () {
4249 _super.apply(this, arguments);
4350
4451 const _setup = this.setup.bind(this);
45− this.setup = function() {
52+ this.setup = function () {
4653 console.groupCollapsed(`Search: ${this.query}`);
47− console.time('Total');
54+ console.time("Total");
4855 return _setup();
4956 };
5057
5158 const _match = this.match.bind(this);
5259 this.match = () => {
53− if (this.matcher) { console.timeEnd(this.matcher.name); }
60+ if (this.matcher) {
61+ console.timeEnd(this.matcher.name);
62+ }
5463 return _match();
5564 };
5665
5766 const _setupMatcher = this.setupMatcher.bind(this);
58− this.setupMatcher = function() {
67+ this.setupMatcher = function () {
5968 console.time(this.matcher.name);
6069 return _setupMatcher();
6170 };
6271
6372 const _end = this.end.bind(this);
64− this.end = function() {
73+ this.end = function () {
6574 console.log(`Results: ${this.totalResults}`);
66− console.timeEnd('Total');
75+ console.timeEnd("Total");
6776 console.groupEnd();
6877 return _end();
6978 };
7079
7180 const _kill = this.kill.bind(this);
72− this.kill = function() {
81+ this.kill = function () {
7382 if (this.timeout) {
74− if (this.matcher) { console.timeEnd(this.matcher.name); }
83+ if (this.matcher) {
84+ console.timeEnd(this.matcher.name);
85+ }
7586 console.groupEnd();
76− console.timeEnd('Total');
77− console.warn('Killed');
87+ console.timeEnd("Total");
88+ console.warn("Killed");
7889 }
7990 return _kill();
8091 };
81−
8292 };
8393
8494 $.extend(app.Searcher, _super);
@@ -89,23 +99,40 @@ app.Searcher.prototype = _proto; · 4 unmodified lines
8999 // View tree
90100 //
91101
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; }
102+this.viewTree = function (view, level, visited) {
103+ if (view == null) {
104+ view = app.document;
105+ }
106+ if (level == null) {
107+ level = 0;
108+ }
109+ if (visited == null) {
110+ visited = [];
111+ }
112+ if (visited.indexOf(view) >= 0) {
113+ return;
114+ }
97115 visited.push(view);
98116
99− console.log(`%c ${Array(level + 1).join(' ')}${view.constructor.name}: ${!!view.activated}`,
100− 'color:' + ((view.activated && 'green') || 'red'));
117+ console.log(
118+ `%c ${Array(level + 1).join(" ")}${
119+ view.constructor.name
120+ }: ${!!view.activated}`,
121+ "color:" + ((view.activated && "green") || "red"),
122+ );
101123
102124 for (var key of Object.keys(view || {})) {
103125 var value = view[key];
104− if ((key !== 'view') && value) {
105− if ((typeof value === 'object') && value.setupElement) {
126+ if (key !== "view" && value) {
127+ if (typeof value === "object" && value.setupElement) {
106128 this.viewTree(value, level + 1, visited);
107129 } 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); } }
130+ for (var k of Object.keys(value || {})) {
131+ var v = value[k];
132+ if (v && typeof v === "object" && v.setupElement) {
133+ this.viewTree(v, level + 1, visited);
134+ }
135+ }
109136 }
110137 }
111138 }