diff --git a/src/components/sfx/SfxPlayer.gd b/src/components/sfx/SfxPlayer.gd index effa4bf..59cd475 100644 --- a/src/components/sfx/SfxPlayer.gd +++ b/src/components/sfx/SfxPlayer.gd @@ -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)