Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jan 21, 2024
1 parent aae3143 commit 2599258
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 50 deletions.
27 changes: 0 additions & 27 deletions .github/WORKFLOWS/go-test.yml

This file was deleted.

11 changes: 8 additions & 3 deletions html/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ <h1 class="mb-4">Hiddify Convertor</h1>
});

document.getElementById("callButton").addEventListener("click", () => {
const input = document.getElementById("inputTextArea").value;
const result = callGoFunction(input); // Modify this function to accept input
document.getElementById("outputTextArea").value = result;
const inputText = document.getElementById("inputTextArea").value;
const outputText = document.getElementById("outputTextArea");
try {
const result = callGoFunction(inputText);
outputText.value = result;
} catch (err) {
outputText.value = "Error: " + err.message;
}
});

document.getElementById("copyButton").addEventListener("click", () => {
Expand Down
20 changes: 0 additions & 20 deletions html/web.go

This file was deleted.

Binary file removed html/web.wasm
Binary file not shown.
28 changes: 28 additions & 0 deletions wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build ignoreunix
// +build ignoreunix

package main

import (
"syscall/js"

"github.com/hiddify/ray2sing/ray2sing"
)

func main() {
c := make(chan struct{}, 0)

// Expose the function to JavaScript
js.Global().Set("callGoFunction", js.FuncOf(callGoFunction))

<-c
}

func callGoFunction(this js.Value, args []js.Value) (string, error) {
input := args[0].String()

// Process the input and generate output
output, err := ray2sing.Ray2Singbox(input)

return output, err
}

0 comments on commit 2599258

Please sign in to comment.