Rewrite trigger method to use `new CustomEvent`

The old way to use document.createElement is deprecated. We now use
CustomEvents as they are provided in JS.

Closes #56.