简体   繁体   中英

How to use Chrome.tabs eventListeners in Javascript

I'm fairly new to Javascript and I know I should master the basics of it before going anywhere but I would like you to explain me how eventListeners work. For example I want to use chrome.tabs.onCreated.addListener(function callback) .

I don't really get what I should put as the callback function. I don't know if that's where I put the code that I want to execute when the event happens or not.

Syntax. element.addEventListener(event, function, useCapture); The first parameter is the type of the event (like "click" or "mousedown"). The second parameter is the function we want to call when the event occurs. The third parameter is a boolean value specifying whether to use event bubbling or event capturing.

Well said w3Schools, this is a great resource to help you out. https://www.w3schools.com/ Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM