-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11874 from dgeb/inject-owner-not-container
[FEATURE ember-registry-container-reform] WIP: Inject `owner` instead of `container` during `lookup`.
- Loading branch information
Showing
98 changed files
with
1,839 additions
and
1,678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { symbol } from 'ember-metal/utils'; | ||
|
||
export const OWNER = symbol('OWNER'); | ||
|
||
export function getOwner(object) { | ||
return object[OWNER]; | ||
} | ||
|
||
export function setOwner(object, owner) { | ||
object[OWNER] = owner; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getOwner, setOwner, OWNER } from 'container/owner'; | ||
|
||
QUnit.module('Owner', {}); | ||
|
||
QUnit.test('An owner can be set with `setOwner` and retrieved with `getOwner`', function() { | ||
let owner = {}; | ||
let obj = {}; | ||
|
||
strictEqual(getOwner(obj), undefined, 'owner has not been set'); | ||
|
||
setOwner(obj, owner); | ||
|
||
strictEqual(getOwner(obj), owner, 'owner has been set'); | ||
|
||
strictEqual(obj[OWNER], owner, 'owner has been set to the OWNER symbol'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import EmberObject from 'ember-runtime/system/object'; | ||
import Registry from 'container/registry'; | ||
import RegistryProxy from 'ember-runtime/mixins/registry_proxy'; | ||
import ContainerProxy from 'ember-runtime/mixins/container_proxy'; | ||
|
||
export default function buildOwner(props) { | ||
let Owner = EmberObject.extend(RegistryProxy, ContainerProxy, { | ||
init() { | ||
this._super(...arguments); | ||
const registry = this.__registry__ = new Registry(); | ||
this.__container__ = registry.container({ owner: this }); | ||
} | ||
}); | ||
return Owner.create(props); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.