| 'use strict'; |
| |
| // This code listens for a message from listnr and pops open the |
| // viewer. |
| |
| chrome.runtime.onMessage.addListener( |
| (request, sender, sendResponse) => { |
| switch (request.action) { |
| case 'open_shill_page': |
| chrome.tabs.create( |
| {'url': chrome.extension.getURL( |
| 'service_states.html#fromFeedback=true')}, |
| (tab) => { |
| // Indicates the browser that actions have completed. We |
| // still wait a bit just to be safe. |
| setTimeout(() => { |
| chrome.tabs.sendMessage(tab.id, {'logData': request.data}, null, |
| (resp) => { |
| console.log('got response:'); |
| console.log(resp); |
| }); |
| console.log('sending response'); |
| sendResponse(); |
| console.log('sent response'); |
| }, 500); |
| }); |
| } |
| return true; |
| } |
| ); |