Skip to content

Commit e2ad675

Browse files
author
Philipp Alferov
committed
Remove IIFE as browserify adds one
1 parent 6a2ae9a commit e2ad675

File tree

1 file changed

+35
-38
lines changed

1 file changed

+35
-38
lines changed

src/angular-file-saver.js

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
/* angular-file-saver
24
*
35
* A AngularJS service that implements the HTML5 W3C saveAs() in browsers that
@@ -8,51 +10,46 @@
810
*
911
*/
1012

11-
(function() {
12-
'use strict';
13-
14-
angular
15-
.module('fileSaver', [])
16-
.factory('SaveAs', SaveAs);
13+
angular
14+
.module('fileSaver', [])
15+
.factory('SaveAs', SaveAs);
1716

18-
function SaveAs() {
17+
function SaveAs() {
1918

20-
function isBlobInstance (data) {
21-
return data instanceof Blob;
22-
}
19+
function isBlobInstance (data) {
20+
return data instanceof Blob;
21+
}
2322

24-
function save(blob, filename) {
25-
try {
26-
saveAs(blob, filename);
27-
} catch(err) {
28-
console.error(err.message);
29-
}
23+
function save(blob, filename) {
24+
try {
25+
saveAs(blob, filename);
26+
} catch(err) {
27+
console.error(err.message);
3028
}
29+
}
3130

32-
return {
33-
34-
/**
35-
* saveFile - Immediately starts saving a file, returns undefined.
36-
*
37-
* @param {array|Blob} data Represented as an array or a Blob object
38-
* @param {string} filename
39-
* @param {object} options Set of Blob constructor options.
40-
* Optional parameter, if Blob object is passed as first argument
41-
* @return {undefined}
42-
*/
31+
return {
4332

44-
download: function (data, filename, options) {
45-
var blob;
46-
data = data instanceof Array ? data : [data];
33+
/**
34+
* saveFile - Immediately starts saving a file, returns undefined.
35+
*
36+
* @param {array|Blob} data Represented as an array or a Blob object
37+
* @param {string} filename
38+
* @param {object} options Set of Blob constructor options.
39+
* Optional parameter, if Blob object is passed as first argument
40+
* @return {undefined}
41+
*/
4742

48-
if (isBlobInstance(data)) {
49-
save(data, filename);
50-
}
43+
download: function (data, filename, options) {
44+
var blob;
45+
data = data instanceof Array ? data : [data];
5146

52-
blob = new Blob(data, options);
53-
save(blob, filename);
47+
if (isBlobInstance(data)) {
48+
save(data, filename);
5449
}
55-
};
56-
}
5750

58-
})();
51+
blob = new Blob(data, options);
52+
save(blob, filename);
53+
}
54+
};
55+
}

0 commit comments

Comments
 (0)