function useLifecycle view code
Uses the lifecycle as a dependency. When the root is started, all providers with the lifecycle's method will have it registered.
Parameters
root: Root
The root that should use the lifecycle.
lifecycle: Lifecycle
The lifecycle to be used.
Returns
Root
The same root for convenience.