immersive-home/app/lib/utils/proxy.gd

22 lines
350 B
GDScript3
Raw Normal View History

2023-11-28 00:46:05 +02:00
extends RefCounted
2024-01-23 18:48:13 +02:00
class_name Proxy
signal on_set(new_value: Variant)
2023-11-28 00:46:05 +02:00
var gettable: Callable
var settable: Callable
func _init(gettable: Callable, settable: Callable):
self.gettable = gettable
self.settable = settable
2024-01-23 18:48:13 +02:00
2023-11-28 00:46:05 +02:00
var value: Variant:
get:
return gettable.call()
set(new_value):
2024-01-23 18:48:13 +02:00
settable.call(new_value)
on_set.emit(new_value)