Skip to content

Commit 24dfef9

Browse files
author
Philipp Alferov
committed
Build assets
1 parent 45e18f7 commit 24dfef9

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

dist/angular-file-saver.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,29 @@ function isString (obj) {
2727
return typeof obj === 'string' || obj instanceof String;
2828
}
2929

30-
function isBlobInstance (obj) {
31-
return obj instanceof Blob;
30+
function isUndefined (obj) {
31+
return typeof obj == "undefined";
3232
}
3333

3434
angular
3535
.module('fileSaver', [])
36-
.factory('SaveAs', SaveAs);
36+
.factory('SaveAs', ['$window', SaveAs]);
3737

38-
function SaveAs() {
38+
function SaveAs ($window) {
39+
var saveAs = $window.saveAs;
40+
var Blob = $window.Blob;
41+
42+
if (isUndefined(saveAs)) {
43+
handleErrors('saveAs is not supported. Please include saveAs polyfill');
44+
}
45+
46+
if (isUndefined(Blob)) {
47+
handleErrors('Blob is not supported. Please include blob polyfill');
48+
}
49+
50+
function isBlobInstance (obj) {
51+
return obj instanceof Blob;
52+
}
3953

4054
function save(blob, filename) {
4155
try {

dist/angular-file-saver.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)