10 examples of 'window addeventlistener javascript' in JavaScript

Every line of 'window addeventlistener javascript' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
12addEventListener(handler) {
13 this.Sender.addEventListener('message', handler)
14}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

32addEventListener(event: string, callback: () => void) {
33 if (!this.eventListeners[event]) {
34 this.eventListeners[event] = []
35 }
36 this.eventListeners[event].push(callback)
37}
38addEventListener(event: string, callback: Function) {
39 if (event == 'message') {
40 this.process.on('message', (message: any) => {
41 callback({ data: message });
42 });
43 }
44}
23public static addEventListener(eventName: string, cb: any, flag: boolean): void {
24 let listeners = this.events[eventName];
25 if (!listeners) {
26 listeners = [];
27 this.events[eventName] = listeners;
28 }
29
30 listeners.push(cb);
31}
41addEventListener(eventName:string, listener: Listener): Handle{
42 var listeners = this.events[eventName];
43 if(listeners){
44 listeners.push(listener);
45 }else{
46 this.events[eventName] = [listener];
47 }
48 var handle: any = {};
49 handle.remove = () => this.removeEventListener(eventName, listener);
50 return handle;
51}
79function addEventListener(listener) {
80 _eventListeners.push(listener);
81}
13function addEventListener(win, event, callback, capture) {
14 let unloadFuncArray = [];
15 let func = bind(this, callbackHandler, callback, unloadFuncArray, win);
16 let unloadFunc = bind(win, win.removeEventListener, event, func, capture || false); // Preparing unload function
17 unloadFuncArray.push(unloadFunc);
18
19 /* Attaching event listener to window */
20 win.addEventListener(event, func, capture || false);
21
22 unloadListeners.push(unloadFunc);
23}
34public addEventListener(event: string, callback: (sender: any, args: any) => void)
35{
36 if (this.events === undefined)
37 {
38 this.events = {};
39 }
40
41 if (this.events[event] === undefined)
42 {
43 this.events[event] = {
44 callbacks: []
45 };
46 }
47
48 this.events[event].callbacks.push(callback);
49}
23function addListeners(window, windowId, targetID) {
24 const target = window.document.getElementById(targetID);
25 if (!target) return;
26
27 target.addEventListener('keydown', (ev) => {
28 if (SPECIAL_KEYS.indexOf(ev.which) !== -1) return;
29
30 queryCliqz(ev.key, windowId);
31 target.parentElement.style.visibility = 'hidden';
32 ev.preventDefault();
33 });
34
35 window.addEventListener('click', () => {
36 target.parentElement.style.visibility = 'visible';
37 });
38}
142public _addEventListener(type:string, listener:Function, useCapture:boolean = false):void {
143 if (type == "ended") {
144 this._onEndedCall = listener;
145 return;
146 }
147
148 this._listeners.push({type: type, listener: listener, useCapture: useCapture});
149 if (this._audio) {
150 this._audio.addEventListener(type, listener, useCapture);
151 }
152}

Related snippets