Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-async-to-generator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-async-to-generator

Enable async-await for Ember

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ember-async-to-generator

npm version Build Status

Installation

ember install ember-async-to-generator

What does the addon do?

tl;dr: Enable async-await syntax without including the whole babel polyfill.

Under the hood, this addon configures babel's async-to-generator plugin to use RSVP.Promise. The babel plugin defaults to use native Promise which breaks in old browsers.

The transpiled async/await code needs regenerator-runtime. This addon will check target browsers, babel options to properly import the asset (~2.5kb after gzip).

The browsers list support generator and async-await from babel can be found at babel-preset-env/data/plugins.json.

Can I only include the transform for my addon's tests?

Yes, adding ember-async-to-generator to your addon's devDependencies will not affect host apps.

Notice your addon's local development will also have async/await available. To avoid async/await code from addon, you can add lint rules to make sure async/await is test only.

What about ember-maybe-import-regenerator(-for-testing)?

ember-maybe-import-regenerator and ember-maybe-import-regenerator-for-testing only imports the regenerator assets, but your app will still be using native Promise.

ember-async-to-generator will check existence of those two addons to avoid duplicate import. If you wish to only import the asset in test, you can install ember-maybe-import-regenerator-for-testing and eslint-plugin-disable-features, see this blog post.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 10 Feb 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc