Code coverage report for ./src/ocLazyLoad.loaders.cssLoader.js

Statements: 100% (12 / 12)      Branches: 100% (0 / 0)      Functions: 100% (7 / 7)      Lines: 100% (12 / 12)      Ignored: none     

All files » ./src/ » ocLazyLoad.loaders.cssLoader.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33    1     1 29                 28 3 3 3   3 2   1     28   28        
'use strict';
 
(function (angular) {
    'use strict';
 
    angular.module('oc.lazyLoad').config(function ($provide) {
        $provide.decorator('$ocLazyLoad', function ($delegate, $q) {
            /**
             * cssLoader function
             * @type Function
             * @param paths array list of css files to load
             * @param callback to call when everything is loaded. We use a callback and not a promise
             * @param params object config parameters
             * because the user can overwrite cssLoader and it will probably not use promises :(
             */
            $delegate.cssLoader = function (paths, callback, params) {
                var promises = [];
                angular.forEach(paths, function (path) {
                    promises.push($delegate.buildElement('css', path, params));
                });
                $q.all(promises).then(function () {
                    callback();
                }, function (err) {
                    callback(err);
                });
            };
            $delegate.cssLoader.ocLazyLoadLoader = true;
 
            return $delegate;
        });
    });
})(angular);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkM6L3d3dy9vY0xhenlMb2FkL3NyYy9vY0xhenlMb2FkLmxvYWRlcnMuY3NzTG9hZGVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsQ0FBQyxVQUFBLE9BQU8sRUFBSTtBQUNSLGdCQUFZLENBQUM7O0FBRWIsV0FBTyxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsQ0FBQyxNQUFNLENBQUMsVUFBUyxRQUFRLEVBQUU7QUFDcEQsZ0JBQVEsQ0FBQyxTQUFTLENBQUMsYUFBYSxFQUFFLFVBQVUsU0FBUyxFQUFFLEVBQUUsRUFBRTs7Ozs7Ozs7O0FBU3ZELHFCQUFTLENBQUMsU0FBUyxHQUFHLFVBQVMsS0FBSyxFQU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ICAgICAqIGNzc0xvYWRlciBmdW5jdGlvblxyXG4gICAgICAgICAgICAgKiBAdHlwZSBGdW5jdGlvblxyXG4gICAgICAgICAgICAgKiBAcGFyYW0gcGF0aHMgYXJyYXkgbGlzdCBvZiBjc3MgZmlsZXMgdG8gbG9hZFxyXG4gICAgICAgICAgICAgKiBAcGFyYW0gY2FsbGJhY2sgdG8gY2FsbCB3aGVuIGV2ZXJ5dGhpbmcgaXMgbG9hZGVkLiBXZSB1c2UgYSBjYWxsYmFjayBhbmQgbm90IGEgcHJvbWlzZVxyXG4gICAgICAgICAgICAgKiBAcGFyYW0gcGFyYW1zIG9iamVjdCBjb25maWcgcGFyYW1ldGVyc1xyXG4gICAgICAgICAgICAgKiBiZWNhdXNlIHRoZSB1c2VyIGNhbiBvdmVyd3JpdGUgY3NzTG9hZGVyIGFuZCBpdCB3aWxsIHByb2JhYmx5IG5vdCB1c2UgcHJvbWlzZXMgOihcclxuICAgICAgICAgICAgICovXHJcbiAgICAgICAgICAgICRkZWxlZ2F0ZS5jc3NMb2FkZXIgPSBmdW5jdGlvbihwYXRocywgY2FsbGJhY2ssIHBhcmFtcykge1xyXG4gICAgICAgICAgICAgICAgdmFyIHByb21pc2VzID0gW107XHJcbiAgICAgICAgICAgICAgICBhbmd1bGFyLmZvckVhY2gocGF0aHMsIHBhdGggPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgIHByb21pc2VzLnB1c2goJGRlbGVnYXRlLmJ1aWxkRWxlbWVudCgnY3NzJywgcGF0aCwgcGFyYW1zKSk7XHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgICRxLmFsbChwcm9taXNlcykudGhlbigoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soKTtcclxuICAgICAgICAgICAgICAgIH0sIGVyciA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soZXJyKTtcclxuICAgICAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICAkZGVsZWdhdGUuY3NzTG9hZGVyLm9jTGF6eUxvYWRMb2FkZXIgPSB0cnVlO1xyXG5cclxuICAgICAgICAgICAgcmV0dXJuICRkZWxlZ2F0ZTtcclxuICAgICAgICB9KVxyXG4gICAgfSk7XHJcblxyXG59KShhbmd1bGFyKTtcclxuIl19