------------------------------------------------------------------------------------------ -- vide/Event.lua ------------------------------------------------------------------------------------------ if not game then script = (require :: any) "test/wrap-require" end local memoize = require(script.Parent.memoize) local bind = require(script.Parent.bind) local graph = require(script.Parent.graph) type State = graph.State type MaybeState = graph.MaybeState local wrapped = graph.wrapped local Types = require(script.Parent.Types) type Listener = (unknown) -> () local getEventSymbol = memoize(function(name: string): Types.Symbol> return { priority = 2, run = function(instance: Instance, listener: MaybeState) local event: RBXScriptSignal<...unknown> = (instance :: any)[name] if type(listener) == "function" then event:Connect(listener) elseif wrapped(listener) then bind.event(listener :: State, instance, event) else error("Attempt to connect non-function to event", 2) end end } end) local Event = table.freeze(setmetatable({}, {__index = function(_, index: string) return getEventSymbol(index) end})) :: any return Event :: { [string]: unknown }