9 examples of 'mdn addeventlistener' in JavaScript

Every line of 'mdn addeventlistener' 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
14addEventListener(name, callback) {
15 if (!this[listeners][name]) {
16 this[listeners][name] = new Set();
17 }
18 this[listeners][name].add(callback);
19}
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

72addEventListener(type, callback) {
73 this.eventTarget.addEventListener(type, callback);
74 switch (type) {
75 case 'general-status': {
76 return this._addGeneralStatusListener();
77 }
78 case 'workout-end': {
79 return this._addWorkoutEndListener();
80 }
81 }
82}
61addEventListener(name,listener){
62 if(!this[EVENT_SYMBOL][name])
63 this[EVENT_SYMBOL][name] = new Set;
64 this[EVENT_SYMBOL][name].add(listener);
65}
28addEventListener() {
29 // 开始播放
30 this.video.on("play", e => {
31 // 通知 mv 播放
32 this.props.mvStore.controller.subject.next({ type: EnumNotice.MVPlay, data: true });
33 });
34 //暂停
35 this.video.on("pause", e => {
36 // 通知 mv 播放
37 this.props.mvStore.controller.subject.next({ type: EnumNotice.MVPlay, data: false });
38 });
39}
77function addEventListener(element, idref) {
78 element.addEventListener('click',
79 function() {
80 chrome.devtools.inspectedWindow.eval(
81 'var element = document.getElementById("' + idref + '");\n' +
82 'if (element) inspect(element);'
83 );
84 });
85}
132addEventListener(type, listener) {
133 this.__listeners.addEventListener(type, listener);
134}
419function addEventListener(type, listener) {
420 if (!listeners[type]) listeners[type] = [];
421 listeners[type].push(listener);
422}
33addEventListener ( ev, listener, id, scope ) {
34 this.observer.on( ev, listener, id, scope || this );
35
36 return this;
37}
48addEventListener(eventName: string, listener: () => void) {
49 // this.emitter.addListener(eventName, listener);
50}

Related snippets