lazy-imports icon indicating copy to clipboard operation
lazy-imports copied to clipboard

throws error on Array.from when used in Polymer-1 with behavior but when this is resolved with a polyfill it throws another error for Promises.all in IE

Open Ankita-G-Mudgal opened this issue 7 years ago • 2 comments

Description

We are using lazy-import V2.0.1 in our project to import some files lazily, IE throws error on this line

   this.importLazyGroup('lazy').then(function(results) { 

and files are not loaded.

Code

  1. Import in .html file

link rel="import" href="../../../lazy-imports/lazy-imports-behavior.html"

   behaviors: [Polymer.LazyImportsBehavior]

   attached: function() {
        Polymer.RenderStatus.afterNextRender(this, function() {
            console.log("code gets called")
            this.importLazyGroup('lazy').then(function(results) {  // throws error for Array.from
                 console.log("code does not reach here...!!!!")
            }.bind(this));
        });

Console

array from

Browsers Affected

  • [ ] Chrome
  • [ ] Firefox
  • [ ] Safari 9
  • [ ] Safari 8
  • [ ] Safari 7
  • [ ] Edge
  • [x] IE 11
  • [x] IE 10

Ankita-G-Mudgal avatar May 16 '18 09:05 Ankita-G-Mudgal

Proposed solution

workaround found for Array.from error is adding a polyfill found at the below link. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from

I have added the above Polyfill code in method and called that method in ready lifecycle hook. But, once this is resolved we get another error for Promises.all method

Console

promise all

and for this we have imported es6-promise in index.html file

Ankita-G-Mudgal avatar May 16 '18 10:05 Ankita-G-Mudgal

@Ankita-G-Mudgal These are both polyfills that you need to bring.

stramel avatar Jun 21 '18 00:06 stramel