Socket
Socket
Sign inDemoInstall

ember-legacy-class-shim

Package Overview
Dependencies
15
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ember-legacy-class-shim

Backwards compatibility for ES classes in Ember


Version published
Weekly downloads
203
decreased by-8.56%
Maintainers
1
Install size
2.02 MB
Created
Weekly downloads
 

Readme

Source

Build Status

ember-legacy-class-shim

This addon adds a shim which reopens EmberObject and redefines .extend. This allows older versions of Ember to use ES Classes with some restrictions.

Why is this needed?

The reason legacy versions of Ember need this transform lies, at its core, in the double extend which was used for the longest time to inject services and other things. This double extend ends up creating a new class altogether which, due to the way classes are handled internally in Ember, never calls super.

This means that when we define a class using class it's constructor never gets run. A side-effect of this is that class fields, which are assigned in the constructor, do not get assigned. This substantially reduces the usefulness of class syntax and decorators since they rely on class fields working as expected.

What does it fix?

This fixes the double extend problem only. Actually fixing .extend requires changes to CoreObject directly and won't be fixed until later versions of Ember. Once you start using native class syntax, you can't go back.

Installation

  • git clone <repository-url> this repository
  • cd ember-legacy-class-shim
  • npm install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

Keywords

FAQs

Last updated on 11 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc