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,


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?

>Solution :

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

Leave a Reply