Skip to content

Commit d1dfe88

Browse files
authored
chore: replace callbacks with promises where API available (#262)
1 parent 44d8e91 commit d1dfe88

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/scripts/background/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
* @param {Object} message
6161
*/
6262
'do-script-injection': function (message) {
63-
chrome.windows.getCurrent(w => {
64-
chrome.tabs.query({ active: true, windowId: w.id }, tabs => {
63+
chrome.windows.getCurrent().then(w => {
64+
chrome.tabs.query({ active: true, windowId: w.id }).then(tabs => {
6565
chrome.scripting.executeScript({
6666
target: {
6767
// inject the script only into the frame

app/scripts/modules/utils/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ function _getPort () {
128128
function _sendToAll(message, callback) {
129129
var frameId = message.frameId;
130130
var options;
131-
chrome.windows.getCurrent(w => {
132-
chrome.tabs.query({ active: true, windowId: w.id }, tabs => {
131+
chrome.windows.getCurrent().then(w => {
132+
chrome.tabs.query({ active: true, windowId: w.id }).then(tabs => {
133133
// options.frameId allows to send the message to
134134
// a specific frame instead of all frames in the tab
135135
if (frameId !== undefined) {

app/scripts/popup/popup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var utils = require('../modules/utils/utils.js');
44

5-
window.chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
5+
window.chrome.tabs.query({active: true, currentWindow: true}).then(function (tabs) {
66
// Create a port with background page for continuous message communication
77
var port = utils.getPort();
88

0 commit comments

Comments
 (0)