Skip to content

Commit 020ac45

Browse files
committed
add debug() func
1 parent 89c1109 commit 020ac45

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

addons/supabase/Realtime/realtime_client.gd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,22 @@ func _on_data() -> void:
109109
PhxEvents.REPLY:
110110
if _check_response(data) == 0:
111111
pass
112-
print_debug("Received reply = "+to_json(data))
112+
get_parent().get_parent()._print_debug("Received reply = "+to_json(data))
113113
PhxEvents.JOIN:
114114
if _check_response(data) == 0:
115115
pass
116-
print_debug("Joined topic '%s'" % data.topic)
116+
get_parent().get_parent()._print_debug("Joined topic '%s'" % data.topic)
117117
PhxEvents.LEAVE:
118118
if _check_response(data) == 0:
119119
pass
120-
print_debug("Left topic '%s'" % data.topic)
120+
get_parent().get_parent()._print_debug("Left topic '%s'" % data.topic)
121121
PhxEvents.CLOSE:
122122
pass
123-
print_debug("Channel closed.")
123+
get_parent().get_parent()._print_debug("Channel closed.")
124124
PhxEvents.ERROR:
125125
emit_signal("error", data.payload)
126126
SupabaseEvents.DELETE, SupabaseEvents.INSERT, SupabaseEvents.UPDATE:
127-
print_debug("Received %s event..." % data.event)
127+
get_parent().get_parent()._print_debug("Received %s event..." % data.event)
128128
var channel : RealtimeChannel = get_channel(data.topic)
129129
if channel != null:
130130
channel._publish(data)

addons/supabase/Supabase/supabase.gd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var database : SupabaseDatabase
77
var realtime : SupabaseRealtime
88
var storage : SupabaseStorage
99

10+
var debug: bool = false
11+
1012
var config : Dictionary = {
1113
"supabaseUrl": "",
1214
"supabaseKey": ""
@@ -48,3 +50,9 @@ func load_nodes() -> void:
4850
add_child(database)
4951
add_child(realtime)
5052
add_child(storage)
53+
54+
func debug(debugging: bool) -> void:
55+
debug = debugging
56+
57+
func _print_debug(msg: String) -> void:
58+
if debug: print_debug(msg)

0 commit comments

Comments
 (0)