Skip to content

Commit

Permalink
JS type annotations\!
Browse files Browse the repository at this point in the history
  • Loading branch information
bitonic committed Nov 15, 2011
1 parent 5096e26 commit 855e845
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resources/search.html
Expand Up @@ -48,6 +48,7 @@
</style>

<script type="text/javascript">
// splitWords :: String -> [String]
var splitWords = function(s) {
var ws = s.split(" ");
var trim = [];
Expand All @@ -60,6 +61,10 @@
return trim;
};

// difference :: [String] -> [String]
// -> { different :: Bool
// , words :: [{different :: Bool, word :: String}]
// }
var difference = function(ws, correct) {
var different = false;
var words = [];
Expand All @@ -85,7 +90,9 @@
queryDelimiter: ' ',
});

// spellCheck :: Number -> Object -> [String] -> ()
var spellCheck = function(id, o, words) {
console.log(typeof id);
var correct = splitWords(o.responseText);
var diff = difference(words, correct);
var div = Y.one('#corrector');
Expand All @@ -109,6 +116,7 @@
}
};

// requestSpellCheck :: () -> ()
var requestSpellCheck = function() {
var input = Y.one('#searchInput').get('value');
var uri = '/correct.json';
Expand Down

0 comments on commit 855e845

Please sign in to comment.