Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: client/web/search.dart

Issue 22862004: added a timeout of 500 milliseconds. (Closed) Base URL: git@github.com:dart-lang/dartdoc-viewer.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/lib/search.dart ('k') | client/web/search.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:html' hide Element; 6 import 'dart:html' hide Element;
7 import 'dart:html' as html show Element; 7 import 'dart:html' as html show Element;
8 import 'app.dart'; 8 import 'app.dart';
9 import 'package:dartdoc_viewer/item.dart'; 9 import 'package:dartdoc_viewer/item.dart';
10 import 'package:dartdoc_viewer/search.dart'; 10 import 'package:dartdoc_viewer/search.dart';
11 import 'package:web_ui/web_ui.dart'; 11 import 'package:web_ui/web_ui.dart';
12 import 'package:web_ui/watcher.dart' as watchers; 12 import 'package:web_ui/watcher.dart' as watchers;
13 13
14 /** 14 /**
15 * Component implementing the Dartdoc_viewer search. 15 * Component implementing the Dartdoc_viewer search.
16 */ 16 */
17 class Search extends WebComponent { 17 class Search extends WebComponent {
18 /** Search query. */ 18
19 @observable String searchQuery = "";
20 List<SearchResult> results = toObservable(<SearchResult>[]); 19 List<SearchResult> results = toObservable(<SearchResult>[]);
21 String _lastQuery; 20 String _lastQuery;
22 @observable bool isFocused = false; 21 @observable bool isFocused = false;
23 22
24 int currentIndex = -1; 23 int currentIndex = -1;
25 24
26 void updateResults() { 25 void updateResults() {
27 currentIndex = -1; 26 currentIndex = -1;
28 results.clear(); 27 results.clear();
29 results.addAll(lookupSearchResults(searchQuery, viewer.isDesktop ? 10 : 5)); 28 results.addAll(lookupSearchResults(searchQuery, viewer.isDesktop ? 10 : 5));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Allow writing 's' in the search input. 108 // Allow writing 's' in the search input.
110 document.query('#q').focus(); 109 document.query('#q').focus();
111 event.preventDefault(); 110 event.preventDefault();
112 } else if (event.keyCode == KeyCode.ESC) { 111 } else if (event.keyCode == KeyCode.ESC) {
113 document.body.focus(); 112 document.body.focus();
114 isFocused = false; 113 isFocused = false;
115 event.preventDefault(); 114 event.preventDefault();
116 } 115 }
117 } 116 }
118 } 117 }
OLDNEW
« no previous file with comments | « client/lib/search.dart ('k') | client/web/search.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698