Derek
Derek

Reputation: 8628

Dispatch Custom Javascript Event wiith using the new api for CustomEvent

I have an issue where i am restricted by the version of phantomJS on the server.

When our headless tests run, Im unable to use CustomEvent api in javascript as Phantom does not understand it.

In browser the code works as exepcted:

var event = new CustomEvent("Interval", {
  detail: {
    type: 'foo',
    IntervalId: 1234,
  }
});

dispatchEvent(event);

I need to perform the same task, but by using an older method, pre CustomEvent. Is there a way to do this with the detail object intact?

Upvotes: 0

Views: 32

Answers (1)

Tachibana Shin
Tachibana Shin

Reputation: 3898

this is what you need a polyfill for CustomEvent: https://gist.github.com/WebReflection/6693661

Upvotes: 1

Related Questions