UNPKG

@virtualstate/app-history

Version:

Native JavaScript [app-history](https://github.com/WICG/app-history) implementation

17 lines 569 B
import { assertEvent } from "./event.js"; export function createEvent(event) { if (typeof CustomEvent !== "undefined" && typeof event.type === "string") { if (event instanceof CustomEvent) { return event; } const { type, detail, ...rest } = event; const customEvent = new CustomEvent(type, { detail: detail ?? rest }); Object.assign(customEvent, rest); assertEvent(customEvent, event.type); return customEvent; } return event; } //# sourceMappingURL=create-event.js.map