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

chore: replace callbacks with promises where API available #262

Merged
merged 1 commit into from
Jan 22, 2024
Merged
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
4 changes: 2 additions & 2 deletions app/scripts/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
* @param {Object} message
*/
'do-script-injection': function (message) {
chrome.windows.getCurrent(w => {
chrome.tabs.query({ active: true, windowId: w.id }, tabs => {
chrome.windows.getCurrent().then(w => {
chrome.tabs.query({ active: true, windowId: w.id }).then(tabs => {
chrome.scripting.executeScript({
target: {
// inject the script only into the frame
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/modules/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ function _getPort () {
function _sendToAll(message, callback) {
var frameId = message.frameId;
var options;
chrome.windows.getCurrent(w => {
chrome.tabs.query({ active: true, windowId: w.id }, tabs => {
chrome.windows.getCurrent().then(w => {
chrome.tabs.query({ active: true, windowId: w.id }).then(tabs => {
// options.frameId allows to send the message to
// a specific frame instead of all frames in the tab
if (frameId !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

Expand Down
Loading