aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..ccfe99e
--- /dev/null
+++ b/index.js
@@ -0,0 +1,32 @@
+// @ts-check
+import Translate from './Translate.js'
+import { createMenu, createDropDown, createEditorWidget } from './create.js'
+
+const translate = new Translate("http://localhost:5000")
+
+/**
+ * Debounce
+ * @param {(...args: any[]) => any} func
+ * @param {Number} timeout
+ * @returns {(...args:any[]) => void}
+ */
+
+export function debounce(func, timeout) {
+ var timer
+ return function (...args) {
+ clearTimeout(timer)
+ timer = setTimeout(() => {
+ func.apply(this, args)
+ }, timeout)
+ }
+}
+ /**
+ * The Main Function
+ */
+async function main() {
+ const menu = createMenu()
+ const { source, target } = await createDropDown(menu, translate)
+ await createEditorWidget(translate, source, target)
+}
+
+window.addEventListener("load", main)