define: Creates a key to factory binding

Description Usage Arguments Examples


Creates a key to factory binding


define(..., scope = default, binder = .binder)



injectable bean identifier to factory mappings, the key is the name is matched to a parameter name during injection, the factory responsible for provisioning of the bean, a factory may accept any number of arguments in which case the framework will attempt to inject the argument if a binding to the parameter name exists; if it does not, that argument will not be injected, in which case it is the factory's responsibility to deal with a missing argument


of the bean, wraps the injected factory call specifying provisioning strategy, if omitted a new bean instance will be provisioned each time injection is requested; injectoR also ships with with the singleton scope which will provide once and cache the bean for subsequent calls. Interface allows for custom scoping, the scope parameter must be a function accepting key (name) and the provider - the wrapped injected factory call - a function accepting no parameters responsible for actual provisioning


for this binding, if omitted the new binding is added to the root binder


define (hello = function () 'world', binder = binder ())

injectoR documentation built on May 2, 2019, 1:42 p.m.