66 * @requires angularHelper
77 *
88 * @description
9- * Promise-based utillity service to lazy-load client-side dependencies inside angular controllers.
9+ * Promise-based utility service to lazy-load client-side dependencies inside angular controllers.
1010 *
1111 * ##usage
1212 * To use, simply inject the assetsService into any controller that needs it, and make
2020 * });
2121 * </pre>
2222 *
23- * You can also load individual files, which gives you greater control over what attibutes are passed to the file, as well as timeout
23+ * You can also load individual files, which gives you greater control over what attributes are passed to the file:
2424 *
2525 * <pre>
26- * angular.module("umbraco").controller("my.controller". function(assetsService){
26+ * angular.module("umbraco").controller("my.controller". function(assetsService) {
2727 * assetsService.loadJs("script.js", $scope, {charset: 'utf-8'}, 10000 }).then(function(){
2828 * //this code executes when the script is done loading
2929 * });
3333 * For these cases, there are 2 individual methods, one for javascript, and one for stylesheets:
3434 *
3535 * <pre>
36- * angular.module("umbraco").controller("my.controller". function(assetsService){
36+ * angular.module("umbraco").controller("my.controller". function(assetsService) {
3737 * assetsService.loadCss("stye.css", $scope, {media: 'print'}, 10000 }).then(function(){
3838 * //loadcss cannot determine when the css is done loading, so this will trigger instantly
3939 * });
@@ -55,7 +55,7 @@ angular.module('umbraco.services')
5555 var _op = ( url . indexOf ( "?" ) > 0 ) ? "&" : "?" ;
5656 url = url + _op + "umb__rnd=" + rnd ;
5757 return url ;
58- } ;
58+ }
5959
6060 function convertVirtualPath ( path ) {
6161 //make this work for virtual paths
@@ -72,7 +72,7 @@ angular.module('umbraco.services')
7272 function getFlatpickrLocales ( locales , supportedLocales ) {
7373 return getLocales ( locales , supportedLocales , 'lib/flatpickr/l10n/' ) ;
7474 }
75-
75+
7676 function getLocales ( locales , supportedLocales , path ) {
7777 var localeUrls = [ ] ;
7878 locales = locales . split ( ',' ) ;
@@ -168,17 +168,13 @@ angular.module('umbraco.services')
168168 *
169169 * @param {String } path path to the css file to load
170170 * @param {Scope } scope optional scope to pass into the loader
171- * @param {Object } keyvalue collection of attributes to pass to the stylesheet element
172- * @param {Number } timeout in milliseconds
173171 * @returns {Promise } Promise object which resolves when the file has loaded
174172 */
175- loadCss : function ( path , scope , attributes , timeout ) {
173+ loadCss : function ( path , scope ) {
176174
177175 path = convertVirtualPath ( path ) ;
178176
179- var asset = this . _getAssetPromise ( path ) ; // $q.defer();
180- var t = timeout || 5000 ;
181- var a = attributes || undefined ;
177+ const asset = this . _getAssetPromise ( path ) ;
182178
183179 if ( asset . state === "new" ) {
184180 asset . state = "loading" ;
@@ -207,17 +203,13 @@ angular.module('umbraco.services')
207203 *
208204 * @param {String } path path to the js file to load
209205 * @param {Scope } scope optional scope to pass into the loader
210- * @param {Object } keyvalue collection of attributes to pass to the script element
211- * @param {Number } timeout in milliseconds
212206 * @returns {Promise } Promise object which resolves when the file has loaded
213207 */
214- loadJs : function ( path , scope , attributes , timeout ) {
208+ loadJs : function ( path , scope ) {
215209
216210 path = convertVirtualPath ( path ) ;
217211
218- var asset = this . _getAssetPromise ( path ) ; // $q.defer();
219- var t = timeout || 5000 ;
220- var a = attributes || undefined ;
212+ const asset = this . _getAssetPromise ( path ) ;
221213
222214 if ( asset . state === "new" ) {
223215 asset . state = "loading" ;
@@ -250,7 +242,7 @@ angular.module('umbraco.services')
250242 *
251243 * @param {Array } pathArray string array of paths to the files to load
252244 * @param {Scope } scope optional scope to pass into the loader
253- * @param {string } defaultAssetType optional default asset type used to load assets with no extension
245+ * @param {string } defaultAssetType optional default asset type used to load assets with no extension
254246 * @returns {Promise } Promise object which resolves when all the files has loaded
255247 */
256248 load : function ( pathArray , scope , defaultAssetType ) {
0 commit comments