-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
executable file
·42 lines (32 loc) · 1.07 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var gmail;
function refresh(f) {
if( (/in/.test(document.readyState)) || (typeof Gmail === undefined) ) {
setTimeout('refresh(' + f + ')', 10);
} else {
f();
}
}
var main = function(){
// NOTE: Always use the latest version of gmail.js from
// https://github.com/KartikTalwar/gmail.js
gmail = new Gmail();
console.log('Hello,', gmail.get.user_email())
function getEmail () {
var CurrentEmailsInInbox = gmail.get.visible_emails()
console.log(CurrentEmailsInInbox[0].sender)
var emailList = CurrentEmailsInInbox.map(function(content){
console.log(content.sender)
// chrome.storage.local.storage.set({myTestVar:'my test varrrrrr'});
var editorExtensionId = "ahjabadggnpjhfgkhbmokjgfnmmmpfam"
chrome.runtime.sendMessage(editorExtensionId, {email: content.sender},
function(response) {
if (!response.success)
handleError(url);
});
})
}
gmail.observe.on('load', function(){
getEmail()
});
}
refresh(main);