-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbackground.js
34 lines (25 loc) · 881 Bytes
/
background.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
var meetupEventInfo;
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method == "getMeetupEventInfo"){
sendResponse(meetupEventInfo);
meetupEventInfo=null;
}
});
function done(data){
console.log('done');
}
function tabCreated(data){
console.log('tabCreated');
}
// Called when a message is passed. We assume that the content script
// wants to show the page action.
function onRequest(request, sender, sendResponse) {
if(request && request['meetupEventUrl']){
console.log('in meetup google+ request='+request);
meetupEventInfo=request;
chrome.tabs.create({url: 'https://plus.google.com/events','active':true}, tabCreated);
}
sendResponse({});
};
// Listen for the content script to send a message to the background page.
chrome.extension.onRequest.addListener(onRequest);