Polyfill the native CustomEvent constructor.