惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
L
LangChain Blog
C
Check Point Blog
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
美团技术团队
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
腾讯CDC
B
Blog
G
Google Developers Blog
The Cloudflare Blog
P
Proofpoint News Feed

Ember.js Blog

Ember 7.0 Released Announcing the Official TypeScript Types Public Preview Accessibility Working Group Update The 2020 Ember Roadmap Countdown to The New Year - Built-in Addons Countdown to The New Year - Ember Exam Countdown to The New Year - Ember Code Snippet Countdown to The New Year - Ember Changeset Countdown to The New Year - Ember In Viewport Countdown to The New Year - Ember CLI Update Countdown to The New Year - Ember Template Invocation Location Countdown to The New Year - Ember CLI TypeScript Countdown to The New Year - Ember Bootstrap and Ember Paper Countdown to The New Year - Ember CSS Modules Countdown to The New Year - Ember Mapbox GL Countdown to The New Year - Ember Shepherd Countdown to The New Year - Ember Template Lint Countdown to The New Year - Ember Composable Helpers Countdown to The New Year - Ember Leaflet Countdown to The New Year - Ember Intl Countdown to The New Year - Ember Test Selectors Countdown to The New Year - Ember Power Select Countdown to The New Year - Ember Simple Auth Countdown to The New Year - Ember SVG Jar Countdown to The New Year - Ember Page Title Countdown to The New Year- Ember A11Y Testing Countdown to The New Year - Ember Angle Brackets Codemod Countdown to The New Year - Ember CLI Sass Countdown to The New Year - Ember Animated Countdown to The New Year - Ember Auto Import
Countdown to The New Year - Ember Concurrency
2019-12-05 · via Ember.js Blog

– By Jen Weber

This is the fifth in our DecEmber series–Countdown to The New Year: 31 Days of Ember Addons". We plan to highlight a new addon each day until the new year, and we hope you'll join us for the fun!

Day 5

Let's talk about ember-concurrency. The experience is part joy, part tragedy.

The joy comes from having elegant, straightforward solutions for things like debouncing. The tragedy is that I have to write this code myself when I am working in a non-Ember setting, but I suppose absence makes the heart grow fonder.

What It Does

The ember-concurrency addon helps you "write concise, robust, and beautiful asynchronous code." For example, think about what should happen if a user rapidly clicks a "submit" button. With this addon, there's a nice way to prevent 30 form submissions. Or, what if an API request takes a long time, and you want to be able to cancel it? Promises won't help you, but ember-concurrency tasks will.

Why I Like It

Without ember-concurrency, it would take a lot of effort to manage starting, interrupting, cancelling, restarting, debouncing, queueing, and checking the status of async operations. Yet in a complex, data-rich application, these things often emerge as necessities. It's a relief to have a concise and readable way of handling these behaviors.

Another thing I like about ember-concurrency is that when I read the documentation, it helps me to evaluate whether the code I have written can withstand deviations from the happy path - impatient users, slow API requests, and interrupted animations.

The joy it brings me is that it keeps my code tidy and resilient. I can spend more of my time working on interfaces and interactions, without littering my code with things like an array of promises and booleans to track their resolved states.

This addon is Octane-ready. For developers who are using Ember Octane or Native Classes, ember-concurrency-decorators provides decorator syntax for tasks, which isn't strictly necessary, but it looks nicer.

Do you use this addon? Or one like it? We'd love to hear about Ember addons that bring you joy!