aboutsummaryrefslogtreecommitdiff
path: root/web.js
diff options
context:
space:
mode:
Diffstat (limited to 'web.js')
-rw-r--r--web.js42
1 files changed, 0 insertions, 42 deletions
diff --git a/web.js b/web.js
deleted file mode 100644
index 61b82d5..0000000
--- a/web.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const web = new Vue({
- el: '#web',
- data: {
- word: '',
- timer: undefined,
- definitions: null,
- is_word: null
- },
- methods: {
- searchWord: function() {
- if(!this.word) return;
- if(this.timer) {
- clearTimeout(this.timer);
- this.timer = undefined;
- }
- console.log(this.word);
- fetch(`/def?w=${this.word}`)
- .then((response) => {
- this.is_word = response.ok;
-
- if( response.ok ) {
- response.arrayBuffer().then(res => {
- this.definitions = msgpack.decode(new Uint8Array(res));
- console.log(this.definitions);
- });
- }
- })
- }
- },
- watch: {
- word: function(w) {
- if( w === '' ) {
- this.is_word = null;
- }
- if(this.timer) {
- clearTimeout(this.timer);
- this.timer = undefined;
- }
- this.timer = setTimeout(this.searchWord, 800);
- }
- }
-});