use var event = new CustomEvent(NAME, {
  detail: {...}
};

instead