Sha256: ac8a7de72acb1fd40150a6bd745e5f3350b593f6c960b728355c3cd71bddcf63
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
import { Object as EmberObject } from 'ember-runtime'; import { InjectedProperty } from 'ember-metal'; /** @module @ember/service @public */ /** 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 @return {Ember.InjectedProperty} injection descriptor instance @public */ export function inject(name, options) { return new InjectedProperty('service', name, options); } /** @class Service @extends EmberObject @since 1.10.0 @public */ const Service = EmberObject.extend(); Service.reopenClass({ isServiceFactory: true, }); export default Service;
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/@ember/service/index.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/@ember/service/index.js |