Permalink
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
Cannot retrieve contributors at this time.
Cannot retrieve contributors at this time
| import Object from "ember-runtime/system/object"; | |
| import { createInjectionHelper } from 'ember-runtime/inject'; | |
| /** | |
| 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: | |
| ```javascript | |
| App.ApplicationRoute = Ember.Route.extend({ | |
| authManager: Ember.inject.service('auth'), | |
| model: function() { | |
| 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 service | |
| @since 1.10.0 | |
| @for Ember.inject | |
| @param {String} name (optional) name of the service to inject, defaults to | |
| the property's name | |
| @return {Ember.InjectedProperty} injection descriptor instance | |
| @public | |
| */ | |
| createInjectionHelper('service'); | |
| /** | |
| @class Service | |
| @namespace Ember | |
| @extends Ember.Object | |
| @since 1.10.0 | |
| @public | |
| */ | |
| const Service = Object.extend(); | |
| Service.reopenClass({ | |
| isServiceFactory: true | |
| }); | |
| export default Service; |