History

class TimingSearcher extends app.Searcher

Simon Legner committed 2 years ago

Commit 164fa9a1 parent 864e45e1 file · +16 −30Browse files

Unified · Split

assets/javascripts/debug.js+16−30
@@ -34,43 +34,33 @@ app.start = function () { · 33 unmodified lines
3434 // Searcher
3535 //
3636
37−const _super = app.Searcher;
38−const _proto = app.Searcher.prototype;
39−
40−app.Searcher = function () {
41− _super.apply(this, arguments);
42−
43− const _setup = this.setup.bind(this);
44− this.setup = function () {
37+app.Searcher = class TimingSearcher extends app.Searcher {
38+ setup() {
4539 console.groupCollapsed(`Search: ${this.query}`);
4640 console.time("Total");
47− return _setup();
48− };
41+ return super.setup();
42+ }
4943
50− const _match = this.match.bind(this);
51− this.match = () => {
44+ match() {
5245 if (this.matcher) {
5346 console.timeEnd(this.matcher.name);
5447 }
55− return _match();
56− };
48+ return super.match();
49+ }
5750
58− const _setupMatcher = this.setupMatcher.bind(this);
59− this.setupMatcher = function () {
51+ setupMatcher() {
6052 console.time(this.matcher.name);
61− return _setupMatcher();
62− };
53+ return super.setupMatcher();
54+ }
6355
64− const _end = this.end.bind(this);
65− this.end = function () {
56+ end() {
6657 console.log(`Results: ${this.totalResults}`);
6758 console.timeEnd("Total");
6859 console.groupEnd();
69− return _end();
70− };
60+ return super.end();
61+ }
7162
72− const _kill = this.kill.bind(this);
73− this.kill = function () {
63+ kill() {
7464 if (this.timeout) {
7565 if (this.matcher) {
7666 console.timeEnd(this.matcher.name);
@@ -79,14 +69,10 @@ app.Searcher = function () { · 2 unmodified lines
7969 console.timeEnd("Total");
8070 console.warn("Killed");
8171 }
82− return _kill();
83− };
72+ return super.kill();
73+ }
8474 };
8575
86−$.extend(app.Searcher, _super);
87−_proto.constructor = app.Searcher;
88−app.Searcher.prototype = _proto;
89−
9076 //
9177 // View tree
9278 //