[example request] Basic usage with `ember-ajax`
See original GitHub issueThere are example that uses low-level xhr
, but the most common use case (apart from Ember Data) is ember-ajax.
What is the most efficient and compact way of using ember-concurrency
with ember-ajax
? Is it possible to cancel ember-ajax
requests?
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Service for making AJAX requests in Ember applications
Basic Usage. The AJAX service provides methods to be used to make AJAX requests, similar to the way that you would use jQuery.ajax...
Read more >how send Post request with ajax in ember.js? - Stack Overflow
1 Answer 1 · 2. It's better to use ember-ajax now. · Yes, ember ajax is a better solution: It is here: github.com/ember-cli/ember-ajax...
Read more >Loading and Saving Data With jQuery's Ajax - Ember Guides
When your user enters a route, Ember will ask the associated Ember.Route object to convert the current URL into a model. For example,...
Read more >ember-ajax - npm
Ajax Service. Basic Usage. The AJAX service provides methods to be used to make AJAX requests, similar to the way that you would...
Read more >Ember Ajax and Ember Simple Auth | Timmy O'Mahony
Ember Ajax is centered around a service that you can use in your routes, controllers and components. This service has a request(.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ember-ajax now supports this on master. Not sure if there are plans for ember-concurrency to cancel the requests itself when things like a component gets destroyed.
Here is an example of what I am doing (changed code from what I actually used so could be mistakes)
@robclancy that looks good to me; do you even need to check ready state? In my experience
abort()
ing a complete XHR just no-ops.In an upcoming version of EC it’ll be possible to import a symbol from EC and use it to implement a method on objects or their prototypes so that when they’re yielded in an EC task, it’ll provide EC with extra information as to how to cancel them.
The goal is that you’d be able to implement this fn on ember-ajax’s promise, something like
This would make it so that anywhere else in your code you could just write
I’m not 100% I’ll be exposing this since it’s kind of changes behavior everywhere and might “over-cancel” in some cases but I’m leaning towards adding it.