Every line of 'window.dispatchevent' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
8 export default function dispatchEvent(window: EventWindow, detail: any) { 9 let event 10 try { 11 event = new window.CustomEvent('unlockProtocol', { detail }) 12 } catch (e) { 13 // older browsers do events this clunky way. 14 // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#The_old-fashioned_way 15 // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent#Parameters 16 event = window.document.createEvent('customevent') 17 event.initCustomEvent( 18 'unlockProtocol', 19 true /* canBubble */, 20 true /* cancelable */, 21 detail 22 ) 23 } 24 window.dispatchEvent(event) 25 }
239 dispatchEvent(evt) { 240 this.documentElement.dispatchEvent(evt) 241 }
3 export function dispatchEvent (element: Element, type: string, 4 eventInit: { bubbles?: boolean, cancelable?: boolean, detail: {} } = {}) { 5 const { bubbles = true, cancelable = true, detail = {} } = eventInit 6 const event = new CustomEvent(type, { bubbles, cancelable, detail }) 7 element.dispatchEvent(event) 8 return event 9 }
37 function dispatchEvent(detail: any, window: any) { 38 let event 39 try { 40 event = new window.CustomEvent('unlockProtocol', { detail }) 41 } catch (e) { 42 // older browsers do events this clunky way. 43 // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#The_old-fashioned_way 44 // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent#Parameters 45 event = window.document.createEvent('customevent') 46 event.initCustomEvent( 47 'unlockProtocol', 48 true /* canBubble */, 49 true /* cancelable */, 50 detail 51 ) 52 } 53 window.dispatchEvent(event) 54 }
158 function _dispatchEvent(eventName, detail) { 159 let event = new CustomEvent(eventName, { 160 detail 161 }); 162 163 TARGET.dispatchEvent(event); 164 }
285 public _dispatchEvent (event: WebViewEventType) { 286 const callback = this._EventList[event]; 287 if (callback && this._iframe) { 288 callback.call(this, this, this._iframe.src); 289 } 290 }
93 dispatchEvent(eventName, ...args) { 94 if (!(eventName in this.listeners)) { 95 return true; 96 } 97 const stack = this.listeners[eventName].slice(); 98 99 for (let i = 0, l = stack.length; i < l; i++) { 100 stack[i].call(this, ...args); 101 } 102 }
286 dispatchEvent(eventName, eventArguments) 287 { 288 if (!this._dispatcher) { 289 console.error(`No domain dispatcher registered for domain '${this._domainName}', for event '${this._domainName}.${eventName}'`); 290 return false; 291 } 292 293 if (!(eventName in this._dispatcher)) { 294 console.error(`Protocol Error: Attempted to dispatch an unimplemented method '${this._domainName}.${eventName}'`); 295 return false; 296 } 297 298 this._dispatcher[eventName].apply(this._dispatcher, eventArguments); 299 return true; 300 }
194 window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { 195 if (!arguments.length) { 196 throw new Error('Not enough arguments'); 197 } 198 199 if (!event || typeof event.type !== 'string') { 200 throw new Error('DOM Events Exception 0'); 201 } 202 203 var element = this, type = event.type; 204 205 try { 206 if (!event.bubbles) { 207 event.cancelBubble = true; 208 209 var cancelBubbleEvent = function (event) { 210 event.cancelBubble = true; 211 212 (element || window).detachEvent('on' + type, cancelBubbleEvent); 213 }; 214 215 this.attachEvent('on' + type, cancelBubbleEvent); 216 } 217 218 this.fireEvent('on' + type, event); 219 } catch (error) { 220 event.target = element; 221 222 do { 223 event.currentTarget = element; 224 225 if ('_events' in element && typeof element._events[type] === 'function') { 226 element._events[type].call(element, event); 227 } 228 229 if (typeof element['on' + type] === 'function') { 230 element['on' + type].call(element, event); 231 } 232 233 element = element.nodeType === 9 ? element.parentWindow : element.parentNode; 234 } while (element && !event.cancelBubble); 235 } 236 237 return true; 238 };
64 _dispatchEvent (evt, type) { 65 evt.target = this 66 if (this._captureListeners && type === 0) { 67 let cls = this._captureListeners[evt.type] 68 cls && cls.forEach(fn => { 69 fn.call(this, evt) 70 }) 71 } 72 73 if (this._listeners && type === 1) { 74 let ls = this._listeners[evt.type] 75 ls && ls.forEach(fn => { 76 fn.call(this, evt) 77 }) 78 } 79 }