Skip to content

Library doesn't work in Internet Explorer #17

@Pravin-Parkhi

Description

@Pravin-Parkhi

While using demos in Internet Explorer, library throws error Object doesn't support this action. This error caused by below snippet.
scope.dispatchEvent(new CustomEvent('lmddbeforestart', {'bubbles': true})).

Reported error is coming because for IE versions >= 9, custom events must be created using document.createEvent() and then initialized using the initCustomEvent method of the previously created event.

So after doing stackoverflow I found we can fix this issue by adding below pollyfill provided by mozila firefox.

(function () {
  if ( typeof window.CustomEvent === "function" ) return false;
  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: undefined };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;
   }
  CustomEvent.prototype = window.Event.prototype;
  window.CustomEvent = CustomEvent;
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions