# An Analysis of 3D LUT Filter Color-Mapping Principles and a JS Implementation

# An Analysis of 3D LUT Filter Color-Mapping Principles and a JS Implementation by zhangxinxu from https://www.zhangxinxu.com/wordpress/?p=9275 This article may be shared and aggregated, but please do not repost it in full. Respect copyright; the circle is only so big. If you ne...

Code: Dispatching a CustomEvent

const event = new CustomEvent('show', {
  detail: { message: payload, sentAt: new Date().toLocaleTimeString() }
});

window.dispatchEvent(event);
Result
Waiting for an event...

Code: Listening for the Event Payload

window.addEventListener('show', (event) => {
  render(event.detail.message, event.detail.sentAt);
});
Event log
No events yet.