Introduces promise manager
This commit is contained in:
parent
cd02870ab5
commit
125dc9545a
@ -87,10 +87,11 @@ module.exports = function (grunt) {
|
|||||||
compress: {
|
compress: {
|
||||||
files: [{
|
files: [{
|
||||||
'<%= project.build %>/js/adagios.min.js' : [
|
'<%= project.build %>/js/adagios.min.js' : [
|
||||||
|
'<%= project.app %>/app.js',
|
||||||
'<%= project.app %>/app.js',
|
'<%= project.app %>/app.js',
|
||||||
'<%= project.app %>/components/config/config.js',
|
'<%= project.app %>/components/config/config.js',
|
||||||
|
'<%= project.app %>/components/utils/promise_manager.js',
|
||||||
'<%= project.app %>/components/live/live.js',
|
'<%= project.app %>/components/live/live.js',
|
||||||
'<%= project.app %>/components/live/notifications.js',
|
|
||||||
'<%= project.app %>/components/live/get_objects.js',
|
'<%= project.app %>/components/live/get_objects.js',
|
||||||
'<%= project.app %>/components/ng-justgage/ng-justgage.js',
|
'<%= project.app %>/components/ng-justgage/ng-justgage.js',
|
||||||
'<%= project.app %>/components/filters/filters.js',
|
'<%= project.app %>/components/filters/filters.js',
|
||||||
@ -135,8 +136,8 @@ module.exports = function (grunt) {
|
|||||||
{
|
{
|
||||||
'<%= project.build %>/app.js': '<%= project.app %>/app.js',
|
'<%= project.build %>/app.js': '<%= project.app %>/app.js',
|
||||||
'<%= project.build %>/components/config/config.js': '<%= project.app %>/components/config/config.js',
|
'<%= project.build %>/components/config/config.js': '<%= project.app %>/components/config/config.js',
|
||||||
|
'<%= project.build %>/components/utils/promise_manager.js': '<%= project.app %>/components/utils/promise_manager.js',
|
||||||
'<%= project.build %>/components/live/live.js': '<%= project.app %>/components/live/live.js',
|
'<%= project.build %>/components/live/live.js': '<%= project.app %>/components/live/live.js',
|
||||||
'<%= project.build %>/components/live/notifications.js': '<%= project.app %>/components/live/notifications.js',
|
|
||||||
'<%= project.build %>/components/live/get_objects.js': '<%= project.app %>/components/live/get_objects.js',
|
'<%= project.build %>/components/live/get_objects.js': '<%= project.app %>/components/live/get_objects.js',
|
||||||
'<%= project.build %>/components/ng-justgage/ng-justgage.js': '<%= project.app %>/components/ng-justgage/ng-justgage.js',
|
'<%= project.build %>/components/ng-justgage/ng-justgage.js': '<%= project.app %>/components/ng-justgage/ng-justgage.js',
|
||||||
'<%= project.build %>/components/filters/filters.js': '<%= project.app %>/components/filters/filters.js',
|
'<%= project.build %>/components/filters/filters.js': '<%= project.app %>/components/filters/filters.js',
|
||||||
@ -177,8 +178,8 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.build %>/js/adagios.min.js' : [
|
'<%= project.build %>/js/adagios.min.js' : [
|
||||||
'<%= project.build %>/app.js',
|
'<%= project.build %>/app.js',
|
||||||
'<%= project.build %>/components/config/config.js',
|
'<%= project.build %>/components/config/config.js',
|
||||||
|
'<%= project.build %>/components/utils/promise_manager.js',
|
||||||
'<%= project.build %>/components/live/live.js',
|
'<%= project.build %>/components/live/live.js',
|
||||||
'<%= project.build %>/components/live/notifications.js',
|
|
||||||
'<%= project.build %>/components/live/get_objects.js',
|
'<%= project.build %>/components/live/get_objects.js',
|
||||||
'<%= project.build %>/components/ng-justgage/ng-justgage.js',
|
'<%= project.build %>/components/ng-justgage/ng-justgage.js',
|
||||||
'<%= project.build %>/components/filters/filters.js',
|
'<%= project.build %>/components/filters/filters.js',
|
||||||
|
@ -16,6 +16,7 @@ angular.element(document).ready(function () {
|
|||||||
angular.module('adagios', [
|
angular.module('adagios', [
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
'adagios.config',
|
'adagios.config',
|
||||||
|
'adagios.utils.promiseManager',
|
||||||
'adagios.topbar',
|
'adagios.topbar',
|
||||||
'adagios.sidebar',
|
'adagios.sidebar',
|
||||||
'adagios.host',
|
'adagios.host',
|
||||||
|
26
app/components/utils/promise_manager.js
Normal file
26
app/components/utils/promise_manager.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('adagios.utils.promiseManager', [])
|
||||||
|
|
||||||
|
.value('ajaxPromises', [])
|
||||||
|
|
||||||
|
.service('addAjaxPromise', ['ajaxPromises', function (ajaxPromises) {
|
||||||
|
return function (promise) {
|
||||||
|
ajaxPromises.push(promise);
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.service('clearAjaxPromises', ['$interval', 'ajaxPromises', function (ajaxPromises) {
|
||||||
|
return function ($interval) {
|
||||||
|
angular.forEach(ajaxPromises, function (promise) {
|
||||||
|
$interval.cancel(promise);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.service('clearAllPromises', ['ajaxPromises', 'clearAjaxPromises',
|
||||||
|
function (ajaxPromises, clearAjaxPromises) {
|
||||||
|
return function () {
|
||||||
|
clearAjaxPromises();
|
||||||
|
};
|
||||||
|
}]);
|
Loading…
Reference in New Issue
Block a user