UNPKG

@observablehq/notebook-inspector

Version:

[![CircleCI](https://circleci.com/gh/observablehq/notebook-inspector/tree/master.svg?style=svg)](https://circleci.com/gh/observablehq/notebook-inspector/tree/master)

13 lines (12 loc) 400 B
export default function dispatch(node, type, detail) { detail = detail || {}; var document = node.ownerDocument, event = document.defaultView.CustomEvent; if (typeof event === "function") { event = new event(type, {detail: detail}); } else { event = document.createEvent("Event"); event.initEvent(type, false, false); event.detail = detail; } node.dispatchEvent(event); }