{"version":"1.0","type":"rich","title":"Cross-browsers events listener implementation","description":"This example shows a cross-browser event listener abstraction that normalizes how JavaScript attaches and removes DOM event handlers. The code defines an `addListener` and `removeListener` pair, then initializes them by detecting the available API at runtime. It uses the standard `window.addEventListener` and `removeEventListener` methods when supported, falls back to Internet Explorer’s `document.attachEvent` and `detachEvent` with an `'on'` prefix, and finally uses direct `el['on' + type]` property assignment for older browsers. The logic is contained in a single self-invoking object that returns itself, ready for use without any external libraries.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-1067125?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}