change to keydown from keyup; add delayed $updateView

- There was a perceived lag when typing do to the fact that we were
   listening on the keyup event instead of keydown. The issue with
   keydown is that we can not read the value of the input field. To
   solve this we schedule a defer call and perform the model update
   then.

 - To prevent calling $eval on root scope too many times as well as to
   prevent drowning the browser with too many updates we now call the
   $eval only after 25ms and any additional requests get ignored. The
   new update service is called $updateView
This commit is contained in:
Misko Hevery
2010-12-10 13:55:18 -08:00
committed by Igor Minar
parent 16086aa37c
commit 47c454a315
18 changed files with 204 additions and 51 deletions

View File

@@ -244,7 +244,7 @@ var TAG = {
name: function(doc, name, value) {
var parts = value.split(/\./);
doc.name = value;
doc.shortName = parts.pop();
doc.shortName = parts.pop().replace('#', '.');
doc.depth = parts.length;
},
param: function(doc, name, value){
@@ -378,6 +378,7 @@ function processNgDoc(documentation, doc) {
if (doc.methodOf) {
if (parent = documentation.byName[doc.methodOf]) {
(parent.method = parent.method || []).push(doc);
parent.method.sort(keywordSort);
} else {
throw 'Owner "' + doc.methodOf + '" is not defined.';
}

View File

@@ -1,5 +1,3 @@
SyntaxHighlighter['defaults'].toolbar = false;
DocsController.$inject = ['$location', '$browser', '$window'];
function DocsController($location, $browser, $window) {
this.pages = NG_PAGES;
@@ -38,10 +36,12 @@ function DocsController($location, $browser, $window) {
return "mailto:angular@googlegroups.com?" +
"subject=" + escape("Feedback on " + $location.href) + "&" +
"body=" + escape("Hi there,\n\nI read " + $location.href + " and wanted to ask ....");
}
};
}
angular.filter('short', function(name){
return (name||'').split(/\./).pop();
});
});
SyntaxHighlighter['defaults'].toolbar = false;

View File

@@ -25,19 +25,23 @@
{{/requires}}
</ul>
{{#method.length}}
<h2>Methods</h2>
<ul>
{{#method}}
<li><tt>{{shortName}}</tt>: {{{description}}}</li>
<li><tt>{{shortName}}()</tt>: {{{description}}}</li>
{{/method}}
</ul>
{{/method.length}}
{{#property.length}}
<h2>Properties</h2>
<ul>
{{#property}}
<li><tt>{{name}}:{{#type}}{{type}}{{/type}}</tt>{{#description}}: {{{description}}}{{/description}}</li>
{{/property}}
</ul>
{{/property.length}}
{{#example}}
<h2>Example</h2>