Provider
Constructs and returns a new provider within Oh My Prvd. Providers must be
created before calling Prvd.ignite()
.
Too verbose?
If writing prvd.Provider
sounds verbose for you, Oh My Prvd
aliases the Provider
constructor with new
:
local prvd = require(ReplicatedStorage.Packages.ohmyprvd)
local PointsProvider = {}
return prvd.new("PointsProvider", PointsProvider)
For consistency, we recommend using Provider
when favorable, as
new
is a reserved keyword in TypeScript.
Parameters
name : string
A unique name to identify the provider with. This will be used for debugging.
provider : T
The methods and properties of the provider. Oh My Prvd provides two lifecycle methods out of the box which may be specified:
:onInit
runs sequentially before any other lifecycle methods, methods are expected to be infallible and preferably non-yielding.:onStart
runs concurrently after all other lifecycle methods have been registered. This means failures and yields do not affect other providers.
In addition, the provider may also specify a loadOrder
property which
dictates when the provider is loaded, defaults to one.
Returns : Provider<T>
A freshly registered provider.