# Create and Download ZIP Files Entirely with Client-Side JavaScript
# Create and Download ZIP Files Entirely with Client-Side JavaScript by zhangxinxu from https://www.zhangxinxu.com/wordpress/?p=8885 ## 1. How It Started I previously built an SVG Sprites extraction tool: upload a combined SVG Sprites file, and it splits it into individual SVG f...
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.