I have a chrome extension that im making for my site, currently i have the extension checking the database every minute for updates.
Is it possible to have the extension listen for an event on the actual page?
Something like this
this.trigger('sendUpdate', data) //this happened on the page
this.on(sendUpdate, function(){ //this is what the chrome extension listens for
//do stuff with data
})
you need to add a content_script.
content_script have full access to the DOM and you can bind to all events on page
just add this to the menifest file
Read the documentation here
Also, from your question, it looks like you going to be working with a custom event so your content_scrip js is going to be something similar to this
The background page should listen for a message.
Then you can trigger the Event from all scripts on the page…