Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

[FEATURE] Adds Owner #240

Merged
merged 1 commit into from
Mar 9, 2020
Merged

[FEATURE] Adds Owner #240

merged 1 commit into from
Mar 9, 2020

Conversation

pzuraq
Copy link
Member

@pzuraq pzuraq commented Feb 14, 2020

Adds a owner argument that can be passed to renderComponent. This
value is provided to every manager in that render tree via the manager
factory:

setComponentManager((owner) => new CustomManager(owner), {});

Conceptually, the owner here is similar to the owner in Ember.js.
Glimmer.js creates a new manager for each unique owner that it receives,
and managers can use the getOwner and setOwner methods to assign it
to passed objects. The owner is an opaque value, so it's up to the
embedding environment to decide what its API is. If no owner is passed,
a default owner is used, and throws an error if the user attempts to use
it for anything.


Breaking changes:

  • Removes support for Ember prior to 3.8, which used a (now deprecated) version of component manager association that relied on Ember's resolver.

@pzuraq pzuraq force-pushed the feature/add-host-meta branch 5 times, most recently from 4d59532 to d8fb158 Compare February 29, 2020 16:22
@pzuraq pzuraq force-pushed the feature/add-host-meta branch 2 times, most recently from ba20d1d to d8bcac6 Compare March 3, 2020 00:43
@pzuraq pzuraq changed the title [FEATURE] Adds HostMeta [FEATURE] Adds Realms Mar 3, 2020
@rwjblue
Copy link
Member

rwjblue commented Mar 4, 2020

I don't fully grok why we need a new concept here, vs using the pre-existing getOwner system (for threading through the renderComponent argument)?

@pzuraq pzuraq changed the title [FEATURE] Adds Realms [FEATURE] Adds Owner Mar 5, 2020
@pzuraq pzuraq force-pushed the feature/add-host-meta branch 2 times, most recently from 827ee11 to 2a782a5 Compare March 5, 2020 22:28
@pzuraq pzuraq added the breaking label Mar 9, 2020
@pzuraq
Copy link
Member Author

pzuraq commented Mar 9, 2020

This also removes support for Ember < 3.8 as well, removing the legacy component managers for Glimmer components

packages/@glimmer/core/src/managers/index.ts Outdated Show resolved Hide resolved
packages/@glimmer/core/src/owner.ts Show resolved Hide resolved
packages/@glimmer/core/src/owner.ts Show resolved Hide resolved
packages/@glimmer/core/src/owner.ts Show resolved Hide resolved
packages/@glimmer/core/test/non-interactive/render-test.ts Outdated Show resolved Hide resolved
packages/@glimmer/core/test/non-interactive/render-test.ts Outdated Show resolved Hide resolved
packages/example-apps/basic/src/MyComponent.ts Outdated Show resolved Hide resolved
.travis.yml Show resolved Hide resolved
Adds a `owner` argument that can be passed to `renderComponent`. This
value is provided to every manager in that render tree via the manager
factory:

```js
setComponentManager((owner) => new CustomManager(owner), {});
```

Conceptually, the owner here is similar to the owner in Ember.js.
Glimmer.js creates a new manager for each unique owner that it receives,
and managers can use the `getOwner` and `setOwner` methods to assign it
to passed objects. The owner is an opaque value, so it's up to the
embedding environment to decide what its API is. If no owner is passed,
a default owner is used, and throws an error if the user attempts to use
it for anything.
@pzuraq pzuraq merged commit 46f7708 into master Mar 9, 2020
@pzuraq pzuraq deleted the feature/add-host-meta branch March 9, 2020 22:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants