Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the method labels update function #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions sources/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,35 @@ chrome.runtime.onInstalled.addListener(function(details) {
considerRefreshingJSON()
});

/*

chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request === 'getLabels')
{
considerRefreshingJSON()

var outcome;
outcome="Fetched"
sendResponse({updateResult: outcome});
return true
var outcome;
outcome="Fetched"
sendResponse({updateResult: outcome});
return true
}
});

*/

function updateLabels() {
considerRefreshingJSON()

var outcome;
outcome="Fetched";
sendResponse({updateResult: outcome});
return true;
}


////// Production-time delay:
setInterval(() => updateLabels(), 60*1000);

////// Debug-time delay:
// setInterval(() => updateLabels(), 15*1000);
16 changes: 0 additions & 16 deletions sources/metabot.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,6 @@ function markTweets()
setTimeout(markTweets, 100);
}

function requestLabels()
{
// 1. Send the background a message requesting the user's data
chrome.runtime.sendMessage('getLabels', (response) => {
// 2. Got an asynchronous response with the data from the background
//// console.log('metabot received response: ', response);
})

////// Production-time delay:
setTimeout(requestLabels, 60*1000);

////// Debug-time delay:
// setTimeout(requestLabels, 15*1000);
}

requestLabels();

loadPrepackagedLabels();

Expand Down