Unified · Split
| @@ -34,43 +34,33 @@ app.start = function () { · 33 unmodified lines | ||
| 34 | 34 | // Searcher |
| 35 | 35 | // |
| 36 | 36 | |
| 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() { | |
| 45 | 39 | console.groupCollapsed(`Search: ${this.query}`); |
| 46 | 40 | console.time("Total"); |
| 47 | − return _setup(); | |
| 48 | − }; | |
| 41 | + return super.setup(); | |
| 42 | + } | |
| 49 | 43 | |
| 50 | − const _match = this.match.bind(this); | |
| 51 | − this.match = () => { | |
| 44 | + match() { | |
| 52 | 45 | if (this.matcher) { |
| 53 | 46 | console.timeEnd(this.matcher.name); |
| 54 | 47 | } |
| 55 | − return _match(); | |
| 56 | − }; | |
| 48 | + return super.match(); | |
| 49 | + } | |
| 57 | 50 | |
| 58 | − const _setupMatcher = this.setupMatcher.bind(this); | |
| 59 | − this.setupMatcher = function () { | |
| 51 | + setupMatcher() { | |
| 60 | 52 | console.time(this.matcher.name); |
| 61 | − return _setupMatcher(); | |
| 62 | − }; | |
| 53 | + return super.setupMatcher(); | |
| 54 | + } | |
| 63 | 55 | |
| 64 | − const _end = this.end.bind(this); | |
| 65 | − this.end = function () { | |
| 56 | + end() { | |
| 66 | 57 | console.log(`Results: ${this.totalResults}`); |
| 67 | 58 | console.timeEnd("Total"); |
| 68 | 59 | console.groupEnd(); |
| 69 | − return _end(); | |
| 70 | − }; | |
| 60 | + return super.end(); | |
| 61 | + } | |
| 71 | 62 | |
| 72 | − const _kill = this.kill.bind(this); | |
| 73 | − this.kill = function () { | |
| 63 | + kill() { | |
| 74 | 64 | if (this.timeout) { |
| 75 | 65 | if (this.matcher) { |
| 76 | 66 | console.timeEnd(this.matcher.name); |
| @@ -79,14 +69,10 @@ app.Searcher = function () { · 2 unmodified lines | ||
| 79 | 69 | console.timeEnd("Total"); |
| 80 | 70 | console.warn("Killed"); |
| 81 | 71 | } |
| 82 | − return _kill(); | |
| 83 | − }; | |
| 72 | + return super.kill(); | |
| 73 | + } | |
| 84 | 74 | }; |
| 85 | 75 | |
| 86 | −$.extend(app.Searcher, _super); | |
| 87 | −_proto.constructor = app.Searcher; | |
| 88 | −app.Searcher.prototype = _proto; | |
| 89 | − | |
| 90 | 76 | // |
| 91 | 77 | // View tree |
| 92 | 78 | // |