Skip to main content

PromiseRemoteEventMixin

Intended for classes that extend BaseObject only

Functions

Add

PromiseRemoteEventMixin:Add(
class{_maidMaid},
remoteEventNamestring
) → ()

Adds the remote function mixin to a class

local BaseObject = require("BaseObject")

local Bird = setmetatable({}, BaseObject)
Bird.ClassName = "Bird"
Bird.__index = Bird

require("PromiseRemoteEventMixin"):Add(Bird, "BirdRemoteEvent")

function Bird.new(inst)
	local self = setmetatable(BaseObject.new(inst), Bird)

	self:PromiseRemoteEvent():Then(function(remoteEvent)
		self._maid:GiveTask(remoteEvent.OnClientEvent:Connect(function(...)
			self:_handleRemoteEvent(...)
		end)
	end)

	return self
end

PromiseRemoteEvent

PromiseRemoteEventMixin:PromiseRemoteEvent() → Promise<RemoteEvent>

Returns a promise that returns a remote event

Show raw api
{
    "functions": [
        {
            "name": "Add",
            "desc": "Adds the remote function mixin to a class\n\n```lua\nlocal BaseObject = require(\"BaseObject\")\n\nlocal Bird = setmetatable({}, BaseObject)\nBird.ClassName = \"Bird\"\nBird.__index = Bird\n\nrequire(\"PromiseRemoteEventMixin\"):Add(Bird, \"BirdRemoteEvent\")\n\nfunction Bird.new(inst)\n\tlocal self = setmetatable(BaseObject.new(inst), Bird)\n\n\tself:PromiseRemoteEvent():Then(function(remoteEvent)\n\t\tself._maid:GiveTask(remoteEvent.OnClientEvent:Connect(function(...)\n\t\t\tself:_handleRemoteEvent(...)\n\t\tend)\n\tend)\n\n\treturn self\nend\n```",
            "params": [
                {
                    "name": "class",
                    "desc": "",
                    "lua_type": "{ _maid: Maid }"
                },
                {
                    "name": "remoteEventName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 40,
                "path": "src/remoting/src/Shared/PromiseRemoteEventMixin.lua"
            }
        },
        {
            "name": "PromiseRemoteEvent",
            "desc": "Returns a promise that returns a remote event",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<RemoteEvent>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 54,
                "path": "src/remoting/src/Shared/PromiseRemoteEventMixin.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PromiseRemoteEventMixin",
    "desc": "Intended for classes that extend BaseObject only",
    "source": {
        "line": 5,
        "path": "src/remoting/src/Shared/PromiseRemoteEventMixin.lua"
    }
}