RealSignal

RealSignalConnection.Disconnect

Disconnects a RealSignalConnection returned by Connect or Once.

语法

RealSignalConnection.Disconnect(connection: RealSignalConnection)

参数

名称类型描述
connectionRealSignalConnectionConnection object returned by RealSignal.Connect or RealSignal.Once.

说明

Disconnects a RealSignalConnection returned by Connect or Once. The method returns no values.

使用 1 个参数调用: connection。参数表会说明哪些值必填,哪些值只用于细化行为。

不返回数据。将调用视为一个动作,并在调用点附近处理错误。

示例

Disconnect a connection returned by RealSignal.Connect or RealSignal.Once.

local signal = Signal.new()
local connection = signal:Connect(function()
    print("fired")
end)

connection:Disconnect()
signal:Fire()

类型

RealSignal

Signal object returned by Signal.new.

Connect (callback: (...any) -> ()) -> RealSignalConnection Adds a callback that runs when Fire is called.Once (callback: (...any) -> ()) -> RealSignalConnection Adds a callback that is disconnected before its first callback invocation.Wait () -> ...any Yields until Fire resumes the waiter with the fired values.Fire (...values: any) -> () Runs connected callbacks and resumes waiters with the provided values.

RealSignalConnection

Connection object returned by RealSignal.Connect and RealSignal.Once.

Disconnect () -> () Disconnects the connection.