Skip to main content

BinderProvider

Provides a basis for binders that can be retrieved anywhere

Functions

new

BinderProvider.new(
serviceNamestring,--

Name of the service (used for memory tracking)

initMethod(
self,
serviceBagServiceBag
)
) → BinderProvider

Constructs a new BinderProvider.

tip

Don't use this! You can retrieve binders from the service bag directly

local serviceBag = ServiceBag.new()

-- Usually in a separate file!
local binderProvider = BinderProvider.new("BirdBinders", function(self, serviceBag)
	self:Add(Binder.new("Bird", require("Bird"), serviceBag))
end)

-- Retrieve binders
local binders = serviceBag:GetService(binderProvider)

-- Runs the game (including binders)
serviceBag:Init()
serviceBag:Start()

isBinderProvider

BinderProvider.isBinderProvider(valueany) → boolean--

True if it is a binder provider

Retrieves whether or not its a binder provider

PromiseBinder

BinderProvider:PromiseBinder(binderNamestring) → Promise<Binder<T>>

Resolves to the given binder given the binderName.

Init

BinderProvider:Init(...ServiceBag | any) → ()

Initializes itself and all binders

PromiseBindersAdded

BinderProvider:PromiseBindersAdded() → Promise

Returns a promise that will resolve once all binders are added.

PromiseBindersStarted

BinderProvider:PromiseBindersStarted() → Promise

Returns a promise that will resolve once all binders are started.

Start

BinderProvider:Start() → ()

Starts all of the binders.

Get

BinderProvider:Get(tagNamestring) → Binder<T>?

Retrieves a binder given a tagName

Add

BinderProvider:Add(binderBinder<T>) → ()

Adds a binder given a tag name.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new BinderProvider.\n\n:::tip\nDon't use this! You can retrieve binders from the service bag directly\n:::\n\n```lua\nlocal serviceBag = ServiceBag.new()\n\n-- Usually in a separate file!\nlocal binderProvider = BinderProvider.new(\"BirdBinders\", function(self, serviceBag)\n\tself:Add(Binder.new(\"Bird\", require(\"Bird\"), serviceBag))\nend)\n\n-- Retrieve binders\nlocal binders = serviceBag:GetService(binderProvider)\n\n-- Runs the game (including binders)\nserviceBag:Init()\nserviceBag:Start()\n```",
            "params": [
                {
                    "name": "serviceName",
                    "desc": "Name of the service (used for memory tracking)",
                    "lua_type": "string"
                },
                {
                    "name": "initMethod",
                    "desc": "",
                    "lua_type": "(self, serviceBag: ServiceBag)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "BinderProvider"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 43,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "isBinderProvider",
            "desc": "Retrieves whether or not its a binder provider",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "True if it is a binder provider",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 71,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "PromiseBinder",
            "desc": "Resolves to the given binder given the binderName.",
            "params": [
                {
                    "name": "binderName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<Binder<T>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 81,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "Init",
            "desc": "Initializes itself and all binders",
            "params": [
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "ServiceBag | any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 107,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "PromiseBindersAdded",
            "desc": "Returns a promise that will resolve once all binders are added.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 133,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "PromiseBindersStarted",
            "desc": "Returns a promise that will resolve once all binders are started.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 142,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "Start",
            "desc": "Starts all of the binders.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 149,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "Get",
            "desc": "Retrieves a binder given a tagName",
            "params": [
                {
                    "name": "tagName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Binder<T>?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 179,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds a binder given a tag name.",
            "params": [
                {
                    "name": "binder",
                    "desc": "",
                    "lua_type": "Binder<T>"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 189,
                "path": "src/binder/src/Shared/BinderProvider.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "BinderProvider",
    "desc": "Provides a basis for binders that can be retrieved anywhere",
    "source": {
        "line": 5,
        "path": "src/binder/src/Shared/BinderProvider.lua"
    }
}