Skip to content

Deprecate Evented and @ember/object/events (RFC 1111) - #21491

Closed
NullVoxPopuli-ai-agent wants to merge 6 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:deprecate-evented
Closed

Deprecate Evented and @ember/object/events (RFC 1111)#21491
NullVoxPopuli-ai-agent wants to merge 6 commits into
emberjs:mainfrom
NullVoxPopuli-ai-agent:deprecate-evented

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown
Contributor

Implements RFC 1111: Deprecating Ember.Evented and @ember/object/events.

This finishes the work started in #20970 (the squashed original work is preserved with @wagenet as author; a follow-up commit rebases it onto current main and resolves the open questions).

What this deprecates

All under the single id deprecate-evented (since: { available: '7.3.0' }, until: '8.0.0', staged as available only since the RFC is at the Accepted stage):

  • Applying the Evented mixin (via a new internal mixin-deprecation mechanism: setDeprecation/findDeprecation fire in Mixin#reopen when a deprecated mixin — or a mixin containing one — is applied, DEBUG-only)
  • Calling the Evented methods on/one/off/trigger/has (including on framework classes like classic Component, Route, and EmberRouter)
  • addListener/removeListener/sendEvent imported from @ember/object/events (deprecating wrappers; the internal @ember/-internals/metal implementations remain silent)
  • The on() event decorator from @ember/object/evented

RouterService exemption

Per the RFC, RouterService's event methods are not deprecated: it no longer extends Evented and instead implements on/one/off/trigger/has directly on top of the internal (non-deprecating) listener functions, with routeWillChange/routeDidChange documented types.

Framework internals fire no deprecations

  • Internal mixin applications (CoreView, Route, EmberRouter) are wrapped in disableDeprecations()
  • Classic component lifecycle events (didInsertElement, willRender, …) and EventDispatcher dispatch now go through new internal sendCoreViewEvent/hasCoreViewListener helpers instead of view.trigger()/view.has()
  • Route activate/deactivate and EmberRouter routeWillChange/routeDidChange use internal sendEvent directly
  • Mixin observer/listener bookkeeping uses the internal addListener/removeListener

This is proven by the ALL_DEPRECATIONS_ENABLED=true suite run: any unexpected deprecation fails a test, and all 9427 tests pass.

Differences from #20970

  • Deprecation id settled as deprecate-evented (was placeholder ember-evented), versions updated from 6.12.0 to 7.3.0; the guide in Add deprecation guide for Ember.Evented and @ember/object/events ember-learn/deprecation-app#1404 (evented.md) should be renamed to deprecate-evented.md and its versions updated to match
  • Rebased onto current main: deep-path imports (ember-local/no-barrel-imports), the removed packages/ember barrel, and the reorganized glimmer internals
  • The previously failing smoke tests and Node.js tests pass (failures appear to have been staleness of the old branch)

Verified locally

  • Browser suite in all four variants: default, ALL_DEPRECATIONS_ENABLED=true, OVERRIDE_DEPRECATION_VERSION=15.0.0, production — 0 failures
  • All 7 smoke-test scenarios (classic, embroider webpack/vite, strict resolver, node), plus classic-basics with OVERRIDE_DEPRECATION_VERSION=15.0.0
  • type-check:internals, type-check:types, eslint, prettier, node tests, docs coverage

🤖 Generated with Claude Code

wagenet and others added 3 commits August 3, 2026 16:24
Squashed from PR emberjs#20970 by Peter Wagenet, rebased onto current main.

Co-authored-by: Peter Wagenet <peter@wagenet.us>
…tibility

- Register the deprecation as `deprecate-evented` (since 7.3.0, until 8.0.0),
  matching the current DEPRECATIONS id conventions
- Use deep module imports per current main conventions
- Drop the resurrected packages/ember/barrel.ts (deleted on main)
- Drop the mixin-deprecation re-exports from the eager utils barrel
setDeprecation(mixin, value) only writes onto its first argument, so when
the mixin is file-local (as in @ember/object/evented) the association is
unobservable unless the module's bindings are imported — same category as
setClassicDecorator and friends.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Function -> ((...args: any[]) => void) narrowing in metal/meta only
served the internal signatures and forced casts at every call site. Keep
the this-aware overloads on the public deprecated surface
(@ember/object/events, RouterService) and leave the internal plumbing
typed as it was on main, so the diff only carries the deprecation work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

interface CoreView extends Evented, ActionHandler, View {}
class CoreView extends FrameworkObject.extend(Evented, ActionHandler) {
class CoreView extends disableDeprecations(() => FrameworkObject.extend(Evented, ActionHandler)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this strategy can't work for communicating deprecation of these mixins, since deprecations are thrown on methods, not just during definition / constructions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b73f967: the framework no longer applies the Evented mixin at all. CoreView/Route/EmberRouter define the methods natively (shared impls in metal/lib/evented-methods), and the definition-time deprecation machinery (mixin-deprecation.ts, the Mixin#reopen hook, disableDeprecations) is deleted — the method-level deprecations are the mechanism.

NullVoxPopuli-ai-agent and others added 2 commits August 3, 2026 17:48
…ixin

CoreView, Route, and EmberRouter now define on/one/off/trigger/has as
native class methods delegating to shared standalone implementations
(metal/lib/evented-methods), the same shape RouterService already uses.
The framework no longer applies the deprecated Evented mixin anywhere,
which removes the machinery that existed only to silence internal
applications:

- utils/lib/mixin-deprecation.ts (setDeprecation/findDeprecation/
  disableDeprecations) and the Mixin#reopen DEBUG hook are gone;
  the deprecation is communicated by the methods themselves.
- CoreView's init-time trigger/has swap hack is unnecessary now that
  the overrides are ordinary class methods.
- @ember/object/evented no longer has a top-level setDeprecation call,
  so the module is side-effect free again and the tree-shakability
  probe no longer needs to know about setDeprecation.

Tests that expected the definition-time "Evented is deprecated" warning
now create their objects without a wrapper; method-call deprecations are
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CoreView, Route, and EmberRouter no longer apply the Evented mixin, but
their instances still provide its methods. Record Evented in each
prototype's meta from a class static block so Mixin#detect keeps
answering true for instances and subclasses, exactly as it did when the
mixin was applied.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NullVoxPopuli

Copy link
Copy Markdown
Contributor

@NullVoxPopuli

Copy link
Copy Markdown
Contributor

superseded by #21542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants