intellij-emberjs-import-support
Version:
Ember.js: support of `import from '@ember/..'` for JetBrains IDEs (Idea, WebStorm, ...)
40 lines (31 loc) • 1.07 kB
JavaScript
/**
Creates a property that lazily looks up a service in the container. There
are no restrictions as to what objects a service can be injected into.
Example:
```app/routes/application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default Route.extend({
authManager: service('auth'),
model() {
return this.get('authManager').findCurrentUser();
}
});
```
This example will create an `authManager` property on the application route
that looks up the `auth` service in the container, making it easily
accessible in the `model` hook.
@method inject
@static
@since 1.10.0
@for @ember/service
@param {String=} name (optional) name of the service to inject, defaults to
the property's name
@param {InjectedPropertyOptions=} options
@return {Ember.InjectedProperty} injection descriptor instance
@public
*/
export function inject(name, options) {
//return new InjectedProperty('service', name, options);
}
export default from '../../@ember-packages/@ember/service';