Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecation guide: window.global #769

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions content/ember/v3/deprecate-window-global.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
id: ember-source.window-global
title: Ember Global
until: 4.0.0
since: 'Upcoming Features'
---

Accessing Ember on the global context (e.g. `window.Ember`, `globalThis.Ember`,
or just `Ember` without importing it) is no longer supported. Migrate to
importing Ember explicitly instead.

Before:

```js
export default class MyComponent extends Ember.Component {
// ...
}
```

After:

```js
import Ember from 'ember';
export default class MyComponent extends Ember.Component {
// ...
}
```

Alternatively, consider converting to use the Ember modules API equivalent to
the API you are using:

```js
import Component from '@ember/component';
export default class MyComponent extends Component {
// ...
}
```

If there is no modules API equivalent, consider refactoring away from using that
API.

For addon authors that need dynamic runtime access where transpiling is not an option,
this be used:
```js
const Ember = require.has('ember') ? require('ember') : window.Ember;
```