I have been trying to run a function in my background.js file when I click a button on my popup.html file, I have tried a bunch of examples online and so far none of them have worked for me.
Here is what Ive tried:
$(".start-btn").click(function() {
var task = loadTaskFromStorage($("#select-task").val());
var checkbox = $('input[type="checkbox"]');
var autobuy = $(checkbox).prop('checked');
var delay = $("#checkout-ms").val();
var count = localStorage.getItem('count');
chrome.storage.sync.set({'task': task.cells, 'count': count}, function() {
});
chrome.storage.sync.set({'autobuy': autobuy, 'delay': delay}, function() {
});
chrome.runtime.sendMessage({'run': true);
then in the background.js file tried to do this:
chrome.runtime.onMessage.addListener(function(message, sender) {
if(!message.run) return;
finder();
});
function finder() {
//pulling json info and opening url loop
});
I want to chrome.storage.sync.get all my things that I saved in my popup.js file then run the function.. I have tried a bunch of solutions and so far none of them have worked for me...
Thank you for helping me in advance <3!