
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
ember-cli-dependency-injection-utils
Advanced tools
A utility library for more concise dependency injection through Ember initializers.
# ember-cli > 0.2.3
ember install ember-cli-dependency-injection-utils
# ember-cli <= 0.2.3
ember install:addon ember-cli-dependency-injection-utils
Below is a sample initializer file/pattern you might create. For additional info, please check out the source.
Simple example
// app/initializers/dependency-injection.js
import { injectThroughout, injectDeps } from 'ember-cli-dependency-injection-utils';
export function initialize(application) {
// Inject factory dependencies onto a specific container
injectDeps(application, 'route', [
{ property: 'api', injectionName: 'service:some-api-client' },
{ property: 'foo', injectionName: 'service:foo-service-you-want-on-every-route' }
]);
// Inject a service to in common Ember places: route, controller, view, component
injectThroughout(application, 'service:some-ga-analytics-you-need-everywhere');
}
export default { name: 'dependency-injection', initialize };
DRY, real world usage example
// app/initializers/dependency-injection.js
import { injectThroughout, injectDeps } from 'ember-cli-dependency-injection-utils';
export function initialize(application) {
// Register anything you need
application.register('config:environment', environment, { singleton: false, instantiate: false });
// Service definitions
const environment = { property: 'environment', injectionName: 'config:environment' };
const routing = { property: 'routing', injectionName: 'service:-routing' };
const site = { property: 'site', injectionName: 'service:site' };
const session = { property: 'session', injectionName: 'service:session' };
const api = { property: 'api', injectionName: 'service:some-api-client' };
// Inject factory dependencies, using service definitions
injectDeps(application, 'service:site', [environment]);
injectDeps(application, 'service:some-api-client', [routing, site, session]);
injectDeps(application, 'route', [api]);
// Inject these services in common Ember places
injectThroughout(application, 'service:site');
injectThroughout(application, 'service:session');
injectThroughout(application, 'service:some-ga-analytics');
injectThroughout(application, 'service:any-service-you-need-everywhere');
}
export default { name: 'dependency-injection', initialize };
README
.FAQs
The default blueprint for ember-cli addons.
The npm package ember-cli-dependency-injection-utils receives a total of 2 weekly downloads. As such, ember-cli-dependency-injection-utils popularity was classified as not popular.
We found that ember-cli-dependency-injection-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.