This commit is contained in:
2023-03-28 00:22:54 +01:00
parent e05267c886
commit 280635d46e
4 changed files with 29 additions and 789 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"bufio"
"fmt"
"os"
@@ -14,10 +13,8 @@ func input(args ...any) string {
output = append(output, anyToArgon(args[i], false, true, 3, 0, true, 0))
}
fmt.Print(output...)
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
input := scanner.Text()
return input
inputData := []byte{}
return string(inputData)
}
func getPassword(args ...any) (string, error) {

View File

@@ -74,6 +74,33 @@ func wasmRun(code string, allowDocument bool) (any, ArErr) {
return ThrowOnNonLoop(run(translated, stack{global, localvars, local}))
}
func await(awaitable js.Value) ([]js.Value, []js.Value) {
then := make(chan []js.Value)
defer close(then)
thenFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
then <- args
return nil
})
defer thenFunc.Release()
catch := make(chan []js.Value)
defer close(catch)
catchFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
catch <- args
return nil
})
defer catchFunc.Release()
awaitable.Call("then", thenFunc).Call("catch", catchFunc)
select {
case result := <-then:
return result, nil
case err := <-catch:
return nil, err
}
}
var IntervalList = []int{}
var TimeoutList = []int{}