|
14 | 14 | angular.module('ngFileSaver', []) |
15 | 15 | .factory('FileSaver', ['Blob', 'SaveAs', 'FileSaverUtils', require('./angular-file-saver.service')]) |
16 | 16 | .factory('FileSaverUtils', [require('./utils/utils.service.js')]) |
17 | | - .factory('Blob', ['$window', require('./dependencies/blob.service.js')]) |
18 | | - .factory('SaveAs', ['$window', require('./dependencies/file-saver.service.js')]); |
| 17 | + .factory('Blob', ['$window', 'FileSaverUtils', require('./dependencies/blob.service.js')]) |
| 18 | + .factory('SaveAs', ['$window', 'FileSaverUtils', require('./dependencies/file-saver.service.js')]); |
19 | 19 |
|
20 | 20 | },{"./angular-file-saver.service":2,"./dependencies/blob.service.js":3,"./dependencies/file-saver.service.js":4,"./utils/utils.service.js":5}],2:[function(require,module,exports){ |
21 | 21 | 'use strict'; |
22 | 22 |
|
23 | 23 | module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) { |
24 | 24 |
|
25 | | - if (FileSaverUtils.isUndefined(FileSaver)) { |
26 | | - FileSaverUtils.handleErrors('saveAs is not supported. Please include saveAs polyfill'); |
27 | | - } |
28 | | - |
29 | | - if (FileSaverUtils.isUndefined(Blob)) { |
30 | | - FileSaverUtils.handleErrors('Blob is not supported. Please include blob polyfill'); |
31 | | - } |
32 | | - |
33 | 25 | function isBlobInstance(obj) { |
34 | 26 | return obj instanceof Blob; |
35 | 27 | } |
@@ -80,15 +72,27 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) { |
80 | 72 | },{}],3:[function(require,module,exports){ |
81 | 73 | 'use strict'; |
82 | 74 |
|
83 | | -module.exports = function Blob($window) { |
84 | | - return $window.Blob; |
| 75 | +module.exports = function Blob($window, FileSaverUtils) { |
| 76 | + var blob = $window.Blob; |
| 77 | + |
| 78 | + if (FileSaverUtils.isUndefined(blob)) { |
| 79 | + FileSaverUtils.handleErrors('Blob is not supported. Please include blob polyfilll'); |
| 80 | + } |
| 81 | + |
| 82 | + return blob; |
85 | 83 | }; |
86 | 84 |
|
87 | 85 | },{}],4:[function(require,module,exports){ |
88 | 86 | 'use strict'; |
89 | 87 |
|
90 | | -module.exports = function SaveAs($window) { |
91 | | - return $window.saveAs; |
| 88 | +module.exports = function SaveAs($window, FileSaverUtils) { |
| 89 | + var saveAs = $window.saveAs; |
| 90 | + |
| 91 | + if (FileSaverUtils.isUndefined(saveAs)) { |
| 92 | + FileSaverUtils.handleErrors('saveAs is not supported. Please include saveAs polyfill'); |
| 93 | + } |
| 94 | + |
| 95 | + return saveAs; |
92 | 96 | }; |
93 | 97 |
|
94 | 98 | },{}],5:[function(require,module,exports){ |
|
0 commit comments