-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathbuild-owner.js
More file actions
35 lines (28 loc) · 1.1 KB
/
build-owner.js
File metadata and controls
35 lines (28 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import EmberObject from 'ember-source/@ember/object/index.js';
import Application from 'ember-source/@ember/application/index.js';
import ApplicationInstance from 'ember-source/@ember/application/instance.js';
import RegistryProxyMixin from 'ember-source/@ember/-internals/runtime/lib/mixins/registry_proxy.js';
import ContainerProxyMixin from 'ember-source/@ember/-internals/runtime/lib/mixins/container_proxy.js';
import { Registry } from 'ember-source/@ember/-internals/container/index.js';
export default function buildOwner(resolver) {
let Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin);
let namespace = EmberObject.create({
Resolver: {
create: function () {
return resolver;
},
},
});
let fallbackRegistry = Application.buildRegistry(namespace);
let registry = new Registry({
fallback: fallbackRegistry,
});
ApplicationInstance.setupRegistry(registry);
let owner = Owner.create({
__registry__: registry,
__container__: null,
});
let container = registry.container({ owner: owner });
owner.__container__ = container;
return owner;
}