aleayr
aleayr

Reputation: 218

Loading bar that tracks completed HTTP requests for Ember.js

I've been looking around, and short of writing a basic one myself, I couldn't find a library that already exists for Ember that displays a small loading line at the top of the page that completes when all the http requests have completed for a page transition (whether that be images loading, JSON being fetched etc).

There's this for Angular: http://chieffancypants.github.io/angular-loading-bar/, but wondering if Ember has any options already.

Cheers.

EDIT: I've found this article as well about a jQuery plugin, which I imagine could be adapted: http://tutorialzine.com/2013/09/quick-tip-progress-bar/. Still keen on hearing if anyone knows of anything already integrated into the Ember request lifecycle though.

Upvotes: 3

Views: 842

Answers (1)

Myslik
Myslik

Reputation: 1158

You can use fantastic javascript component NProgress (http://ricostacruz.com/nprogress)

and then you can initialize it in Application.ready event using jQuery like this

window.App.ready = function () {
    $(document).ajaxStart(function () {
        NProgress.start();
    });

    $(document).ajaxStop(function () {
        NProgress.done();
    });
};

Upvotes: 6

Related Questions