flitter-di/src/Injectable~ Injectable

Base class for classes that support service injection.


new Injectable()

Instantiates the class. If deferral is enabled and the static class has deferred services, register this instance as needing to be injected with those services when they become available.


(private, static) __has_deferred_services

Checks if the class has any missing deferred services.

(static) services

Get the names of services required by this class.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

  • Array.<string>


(private, static) __deferral_callback(service_name, service_instance)

Called when a deferred service is registered with the container. Injects the missing service into the prototype and any instances of this class.

Name Type Description
service_name string

the deferred service name

service_instance module:flitter-di/src/Service~Service

the instance of the service

(private, static) __inject(container)

Inject the class with services from the specified container. These services are injected directly into this class' prototype. If deferral is enabled, services not in the container will be stored and the class will be deferred.

Name Type Description
container module:flitter-di/src/Container~Container