I always use the API, rather than relying on injection in library code. I see the injection as exclusively for interactive use.