Skip to content

Commit

Permalink
temp: js bridge test
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Aug 5, 2024
1 parent 664ebd9 commit cc1bd2c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/sfx/SfxPlayer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,22 @@ func _play_section_select():

func _play_action_select():
action_select.play()

var my_callback = JavaScriptBridge.create_callback(_on_my_callback)


func _init() -> void:
JavaScriptBridge.eval("""
var godotAudioBridge = {
callback: null,
setCallback: (cb) => this.callback = cb,
test: (data) => this.callback(JSON.stringify(data)),
};
""", true)
var godot_bridge = JavaScriptBridge.get_interface("godotBridge")
#godot_bridge.setCallback(my_callback)



func _on_my_callback(args) -> void:
printt('this is coming from js: ', args)

0 comments on commit cc1bd2c

Please sign in to comment.