eligrey / FileSaver.js

An HTML5 saveAs() FileSaver implementation
https://eligrey.com/blog/saving-generated-files-on-the-client-side/
Other
21.58k stars 4.38k forks source link

saveAs inside webcomponent #520

Open BaluVyamajala opened 5 years ago

BaluVyamajala commented 5 years ago

when saveAs for blob is called, its going to this the empty function with just / noop / and not doing anything. I can't seem to figure out why code is going to this spot? I am using file-saver on a web component created out of angluar 7 and hosted in another angular application.

var saveAs = _global.saveAs || (
  // probably in some web worker
  (typeof window !== 'object' || window !== _global)
    ? function saveAs () { /* noop */ }
BaluVyamajala commented 5 years ago

In case when I run the web component separately, _global.saveAs is resulting as undefined , which is helping to not go this blank saveAs function. However, when I run together with in a hosted application, it is resulting in actual function and taking me to this blank saveAs. Please advice.

Ruffio commented 5 years ago

I have no knowledge of web components but I think that you have to adjust the above lines to point to a shadowDOM somehow.

Have you got it resolved yourself?

BaluVyamajala commented 5 years ago

yes, I copied the js file into my application and made changes in my local. removed _global.saveAs in the condition. var saveAs = typeof window !== 'object' || window !== _global