diff options
Diffstat (limited to '_www/kamusku.js')
| -rw-r--r-- | _www/kamusku.js | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/_www/kamusku.js b/_www/kamusku.js index 364fa1b..0152337 100644 --- a/_www/kamusku.js +++ b/_www/kamusku.js @@ -1,35 +1,29 @@ -/** - * Copyright 2020, Shulhan <ms@kilabit.info>. All rights reserved. - * Use of this source code is governed by a BSD-style - * license that can be found in the LICENSE file. - */ +// SPDX-FileCopyrightText: 2020 M. Shulhan <ms@kilabit.info> +// SPDX-License-Identifier: GPL-3.0-or-later class Kamusku { - constructor(baseURL) { - if (baseURL.length === 0) { - baseURL = "" - } - this.baseURL = baseURL - } + constructor(baseURL) { + if (baseURL.length === 0) { + baseURL = ""; + } + this.baseURL = baseURL; + } - getDefinitions(words, cb) { - if (words.length === 0) { - return - } + getDefinitions(words, cb) { + if (words.length === 0) { + return; + } - let params = "kata=" + words - let xhr = new XMLHttpRequest() + let params = "kata=" + words; + let xhr = new XMLHttpRequest(); - xhr.addEventListener("load", function() { - cb(JSON.parse(xhr.responseText)) - }) + xhr.addEventListener("load", function () { + cb(JSON.parse(xhr.responseText)); + }); - xhr.open("GET", this.baseURL + "/api/definisi?" + params) - xhr.setRequestHeader( - "Content-Type", - "application/x-www-form-urlencoded", - ) + xhr.open("GET", this.baseURL + "/api/definisi?" + params); + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - xhr.send(null) - } + xhr.send(null); + } } |
