Version: 2.10.0-alpha.12.11.0-alpha.12.11.0-beta.12.11.0-beta.22.11.0-beta.52.11.0-beta.62.11.0-beta.72.11.0-beta.82.11.02.11.12.11.22.11.32.12.0-beta.12.12.0-beta.22.12.0-beta.32.12.02.12.12.12.22.13.0-beta.12.13.0-beta.22.13.02.13.12.13.22.13.32.13.42.14.0-beta.12.14.0-beta.22.14.0-beta.32.14.02.14.12.15.0-beta.12.15.0-beta.22.15.0-beta.32.15.02.15.12.15.22.15.32.16.0-beta.12.16.0-beta.22.16.02.16.12.16.22.16.32.16.42.17.0-beta.12.17.0-beta.22.17.0-beta.32.17.0-beta.42.17.0-beta.52.17.0-beta.62.17.02.17.12.17.22.18.0-beta.12.18.0-beta.22.18.0-beta.32.18.0-beta.42.18.0-beta.52.18.02.18.12.18.23.0.0-beta.13.0.0-beta.23.0.0-beta.33.0.0-beta.43.0.0-beta.53.0.0-beta.63.0.03.1.0-beta.13.1.0-beta.23.1.0-beta.33.1.0-beta.43.1.0-beta.53.1.03.1.13.1.23.1.33.1.43.2.0-beta.13.2.0-beta.23.2.0-beta.33.2.0-beta.43.2.0-beta.53.2.03.2.13.2.23.3.0-beta.23.3.0-beta.33.3.0-beta.43.3.0-beta.53.3.03.3.13.3.23.4.0-beta.13.4.0-beta.23.4.0-beta.33.4.03.4.13.4.23.4.33.4.43.4.53.4.63.4.73.4.83.5.0-beta.13.5.0-beta.23.5.0-beta.33.5.0-beta.43.5.03.5.13.6.0-beta.13.6.0-beta.23.6.0-beta.33.6.0-beta.43.6.03.6.13.7.0-beta.13.7.0-beta.23.7.0-beta.33.7.03.7.13.7.23.7.33.8.0-beta.13.8.0-beta.23.8.0-beta.33.8.0-beta.43.8.0-beta.53.8.03.8.13.8.23.8.33.9.0-beta.13.9.0-beta.23.9.0-beta.33.9.0-beta.43.9.0-beta.53.9.03.9.13.10.0-beta.13.10.0-beta.23.10.0-beta.33.10.0-beta.43.10.0-beta.53.10.03.10.13.10.23.11.0-beta.13.11.0-beta.23.11.0-beta.33.11.0-beta.43.11.03.11.13.12.0-beta.13.12.03.12.13.12.23.12.33.12.43.13.0-beta.13.13.0-beta.23.13.0-beta.33.13.0-beta.43.13.0-beta.53.13.03.13.13.13.23.13.33.13.43.14.0-beta.13.14.0-beta.23.14.0-beta.33.14.0-beta.43.14.0-beta.53.14.03.14.13.14.23.14.33.15.0-beta.13.15.0-beta.23.15.0-beta.33.15.0-beta.43.15.0-beta.53.15.03.16.0-beta.13.16.03.16.13.16.23.16.33.16.43.16.53.16.63.16.7-beta.13.16.73.16.83.16.93.16.103.17.0-beta.13.17.0-beta.23.17.0-beta.33.17.0-beta.43.17.0-beta.53.17.0-beta.63.17.03.17.13.17.23.17.33.18.0-beta.13.18.0-beta.23.18.0-beta.33.18.0-beta.43.18.0-beta.53.18.03.18.13.19.0-beta.13.19.0-beta.23.19.0-beta.33.19.0-beta.43.19.03.20.0-beta.13.20.0-beta.23.20.0-beta.33.20.0-beta.43.20.0-beta.53.20.03.20.13.20.23.20.33.20.43.20.53.20.63.20.73.21.0-beta.13.21.0-beta.23.21.0-beta.33.21.0-beta.43.21.0-beta.53.21.0-beta.63.21.03.21.13.21.23.21.33.22.0-beta.13.22.0-beta.23.22.0-beta.33.22.0-beta.43.22.0-beta.53.22.03.22.13.22.23.23.0-beta.13.23.0-beta.23.23.0-beta.33.23.0-beta.43.23.0-beta.53.23.03.23.13.24.0-beta.13.24.0-beta.23.24.0-beta.33.24.03.24.13.24.23.24.33.24.43.24.53.24.63.24.73.25.0-beta.13.25.0-beta.23.25.0-beta.33.25.0-beta.43.25.0-beta.53.25.03.25.13.25.23.25.33.25.43.26.0-beta.13.26.0-beta.23.26.0-beta.33.26.0-beta.43.26.0-beta.53.26.03.26.13.26.23.27.0-alpha.23.27.0-beta.13.27.0-beta.23.27.0-beta.33.27.0-beta.43.27.03.27.13.27.23.27.33.27.43.27.53.28.0-alpha.23.28.0-beta.13.28.0-beta.33.28.0-beta.43.28.0-beta.53.28.0-beta.63.28.0-beta.73.28.03.28.13.28.23.28.33.28.43.28.53.28.63.28.73.28.83.28.93.28.103.28.113.28.124.0.0-alpha.24.0.0-beta.14.0.0-beta.24.0.0-beta.34.0.0-beta.44.0.0-beta.54.0.0-beta.64.0.0-beta.74.0.0-beta.84.0.0-beta.94.0.0-beta.104.0.04.0.14.1.0-alpha.24.1.0-alpha.34.1.0-alpha.44.1.0-alpha.54.1.0-alpha.64.1.0-alpha.74.1.0-alpha.84.1.0-beta.14.1.04.2.0-alpha.14.2.0-alpha.24.2.0-alpha.34.2.0-alpha.44.2.0-alpha.54.2.0-alpha.64.2.0-alpha.74.2.0-beta.14.2.04.3.0-alpha.14.3.0-alpha.24.3.0-alpha.34.3.0-alpha.44.3.0-beta.14.3.0-beta.24.3.04.4.0-alpha.14.4.0-alpha.24.4.0-alpha.34.4.0-alpha.44.4.0-alpha.54.4.0-alpha.64.4.0-alpha.74.4.0-beta.14.4.04.4.14.4.24.4.34.4.44.4.54.5.0-alpha.14.5.0-alpha.24.5.0-alpha.34.5.0-alpha.44.5.0-alpha.54.5.0-beta.14.5.0-beta.24.5.04.5.14.6.0-alpha.14.6.0-alpha.24.6.0-alpha.34.6.0-alpha.44.6.0-alpha.54.6.0-alpha.64.6.0-beta.14.6.0-beta.24.6.04.7.0-alpha.14.7.0-alpha.24.7.0-alpha.34.7.0-alpha.44.7.0-alpha.54.7.0-alpha.64.7.0-beta.14.7.04.7.14.8.0-alpha.14.8.0-alpha.24.8.0-alpha.34.8.0-alpha.44.8.0-alpha.54.8.0-alpha.64.8.0-beta.14.8.0-beta.24.8.0-beta.34.8.0-beta.44.8.0-beta.54.8.04.8.14.8.24.8.34.8.44.8.54.8.64.9.0-alpha.14.9.0-alpha.24.9.0-alpha.34.9.0-alpha.44.9.0-alpha.54.9.0-alpha.64.9.0-beta.14.9.0-beta.24.9.0-beta.34.9.0-beta.44.9.04.9.14.9.24.9.34.10.0-alpha.14.10.0-alpha.24.10.0-alpha.34.10.0-alpha.44.10.0-alpha.54.10.0-alpha.64.10.0-beta.14.10.0-beta.24.10.0-beta.34.10.0-beta.44.10.0-beta.54.10.04.11.0-alpha.14.11.0-alpha.24.11.0-alpha.34.11.0-alpha.44.11.0-alpha.54.11.0-alpha.64.11.0-beta.14.11.04.12.0-alpha.14.12.0-alpha.24.12.0-alpha.34.12.0-alpha.44.12.0-alpha.54.12.0-beta.14.12.0-beta.24.12.0-beta.34.12.04.12.14.12.24.12.34.12.45.0.0-alpha.15.0.0-alpha.25.0.0-alpha.35.0.0-alpha.45.0.0-alpha.55.0.0-alpha.65.0.0-alpha.75.0.0-beta.15.0.0-beta.35.0.05.1.0-alpha.15.1.0-alpha.25.1.0-beta.15.1.05.1.15.1.25.2.0-alpha.15.2.0-alpha.25.2.0-alpha.35.2.0-alpha.45.2.0-alpha.55.2.0-beta.15.2.0-beta.25.2.0-beta.35.2.0-beta.45.2.05.3.0-alpha.15.3.0-alpha.25.3.0-alpha.35.3.0-alpha.45.3.0-alpha.55.3.0-alpha.65.3.0-beta.15.3.0-beta.25.3.05.4.0-alpha.15.4.0-alpha.25.4.0-alpha.35.4.0-alpha.45.4.0-alpha.55.4.0-alpha.65.4.0-beta.15.4.05.4.15.5.0-alpha.15.5.0-alpha.25.5.0-alpha.35.5.0-alpha.45.5.0-alpha.55.5.0-beta.15.5.0-beta.25.5.05.6.0-alpha.15.6.0-alpha.25.6.0-alpha.35.6.0-alpha.45.6.0-alpha.55.6.0-alpha.65.6.0-beta.15.6.0-beta.25.6.05.7.0-alpha.15.7.0-alpha.25.7.0-alpha.35.7.0-alpha.45.7.0-alpha.55.7.0-alpha.65.7.0-beta.15.7.0-beta.25.7.05.8.0-alpha.15.8.0-alpha.25.8.0-alpha.35.8.0-alpha.45.8.0-alpha.55.8.0-alpha.65.8.0-beta.15.8.0-beta.25.8.05.9.0-alpha.15.9.0-alpha.25.9.0-alpha.35.9.0-alpha.45.9.0-alpha.55.9.0-alpha.65.9.0-beta.15.9.0-beta.25.9.05.10.0-alpha.15.10.0-alpha.25.10.0-alpha.35.10.0-alpha.45.10.0-beta.15.10.0-beta.25.10.05.10.15.10.25.11.0-beta.15.11.0-beta.25.11.05.11.15.12.0-alpha.15.12.0-alpha.25.12.0-alpha.35.12.0-alpha.45.12.0-beta.15.12.0-beta.25.12.0-beta.35.12.06.0.0-alpha.16.0.0-alpha.26.0.0-alpha.36.0.0-alpha.46.0.0-alpha.56.0.0-alpha.66.0.0-alpha.76.0.0-alpha.86.0.0-alpha.96.0.0-alpha.106.0.0-alpha.116.0.0-beta.16.0.06.0.16.1.0-alpha.16.1.0-alpha.26.1.0-alpha.36.1.0-alpha.46.1.0-alpha.56.1.0-alpha.66.1.0-beta.16.1.0-beta.26.1.06.2.0-alpha.16.2.0-alpha.26.2.0-alpha.36.2.0-alpha.46.2.0-alpha.56.2.0-alpha.66.2.0-alpha.76.2.0-beta.16.2.06.3.0-alpha.16.3.0-alpha.26.3.0-alpha.36.3.0-alpha.46.3.0-alpha.56.3.0-alpha.66.3.0-alpha.76.3.0-beta.16.4.0-alpha.1
declare module '@ember/owner' {
/**
Ember’s dependency injection system is built on the idea of an "owner": an
object responsible for managing items which can be registered and looked up
with the system.
This module does not provide any concrete instances of owners. Instead, it
defines the core type, `Owner`, which specifies the public API contract for an
owner. The primary concrete implementations of `Owner` are `EngineInstance`,
from `@ember/engine/instance`, and its `ApplicationInstance` subclass, from
`@ember/application/instance`.
Along with `Owner` itself, this module provides a number of supporting types
related to Ember's DI system:
- `Factory`, Ember's primary interface for something which can create class
instances registered with the DI system.
- `FactoryManager`, an interface for inspecting a `Factory`'s class.
- `Resolver`, an interface defining the contract for the object responsible
for mapping string names to the corresponding classes. For example, when you
write `@service('session')`, a resolver is responsible to map that back to
the `Session` service class in your codebase. Normally, this is handled for
you automatically with `ember-resolver`, which is the main implementor of
this interface.
For more details on each, see their per-item docs.
@module @ember/owner
@public
*/
import { type default as Owner } from '@ember/-internals/owner';
Framework objects in an Ember application (components, services, routes, etc.)
are created via a factory and dependency injection system. Each of these
objects is the responsibility of an "owner", which handled its
instantiation and manages its lifetime.
`getOwner` fetches the owner object responsible for an instance. This can
be used to lookup or resolve other class instances, or register new factories
into the owner.
For example, this component dynamically looks up a service based on the
`audioType` passed as an argument:
```app/components/play-audio.js
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { getOwner } from '@ember/owner';
// Usage:
//
// <PlayAudio @audioType={{@model.audioType}} @audioFile={{@model.file}}/>
export default class extends Component {
get audioService() {
return getOwner(this)?.lookup(`service:${this.args.audioType}`);
}
@action
onPlay() {
this.audioService?.play(this.args.audioFile);
```
@method getOwner
@static
@for @ember/owner
@param {Object} object An object with an owner.
@return {Object} An owner object.
@since 2.3.0
const getOwner: (object: object) => Owner | undefined;
export { getOwner };
export type { Owner as default };
export {
setOwner,
type FullName,
type RegisterOptions,
type Factory,
type FactoryManager,
type KnownForTypeResult,
type Resolver,
type DIRegistry,
} from '@ember/-internals/owner';