Skip to content

Commit

Permalink
fix for wasm and keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Dec 27, 2024
1 parent ea70f0a commit 76020d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions evaldo/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"reflect"
"sort"

"github.com/cszczepaniak/keyboard"
"github.com/refaktor/rye/env"
"github.com/refaktor/rye/term"

Expand Down Expand Up @@ -8170,8 +8169,9 @@ var builtins = map[string]*env.Builtin{
Doc: "Accepts one value and returns it.",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
// close the keyboard opened for terminal
fmt.Println("Closing keyboard in Exit")
keyboard.Close()
// fmt.Println("Closing keyboard in Exit")
// keyboard.Close()
util.BeforeExit()
switch code := arg0.(type) {
case env.Integer:
os.Exit(int(code.Value))
Expand Down
8 changes: 8 additions & 0 deletions util/util_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build wasm
// +build wasm

package util

func BeforeExit() {

}
16 changes: 16 additions & 0 deletions util/util_wasm_not.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//go:build !wasm
// +build !wasm

package util

import (
"fmt"
"github.com/cszczepaniak/keyboard"

)


func BeforeExit() {
fmt.Println("Closing keyboard in Exit")
keyboard.Close()
}

0 comments on commit 76020d0

Please sign in to comment.