Skip to main content

PromiseRemoteFunctionMixin

Intended for classes that extend BaseObject only

Functions

Add

PromiseRemoteFunctionMixin:Add(
class{_maidMaid},
remoteFunctionNamestring
) → ()

Adds the remote function mixin to a class

local BaseObject = require("BaseObject")

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

require("PromiseRemoteFunctionMixin"):Add(Bird, "BirdRemoteFunction")

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

	self:PromiseRemoteFunction():Then(function(remoteFunction)
		task.spawn(function()
			remoteFunction:InvokeServer() -- or whatever
		end)
	end)

	return self
end

PromiseRemoteFunction

PromiseRemoteFunctionMixin:PromiseRemoteFunction() → Promise<RemoteFunction>

Returns a promise that returns a remote function

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(\"PromiseRemoteFunctionMixin\"):Add(Bird, \"BirdRemoteFunction\")\n\nfunction Bird.new(inst)\n\tlocal self = setmetatable(BaseObject.new(inst), Bird)\n\n\tself:PromiseRemoteFunction():Then(function(remoteFunction)\n\t\ttask.spawn(function()\n\t\t\tremoteFunction:InvokeServer() -- or whatever\n\t\tend)\n\tend)\n\n\treturn self\nend\n```",
            "params": [
                {
                    "name": "class",
                    "desc": "",
                    "lua_type": "{ _maid: Maid }"
                },
                {
                    "name": "remoteFunctionName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 40,
                "path": "src/remoting/src/Shared/PromiseRemoteFunctionMixin.lua"
            }
        },
        {
            "name": "PromiseRemoteFunction",
            "desc": "Returns a promise that returns a remote function",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<RemoteFunction>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 54,
                "path": "src/remoting/src/Shared/PromiseRemoteFunctionMixin.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PromiseRemoteFunctionMixin",
    "desc": "Intended for classes that extend BaseObject only",
    "source": {
        "line": 5,
        "path": "src/remoting/src/Shared/PromiseRemoteFunctionMixin.lua"
    }
}