Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

async function is not wokring #2

Open
hamidsaifi77 opened this issue Dec 5, 2023 · 0 comments
Open

async function is not wokring #2

hamidsaifi77 opened this issue Dec 5, 2023 · 0 comments

Comments

@hamidsaifi77
Copy link

hello,
async functions are not working in the background.js
what I am doing is i have imported a function in background.v3.ts

function thisOne(something: any) {
    alert("HELLO FROM THISONE") // this is not wokring
}

function runFun(something: any) {
    thisOne(something) // this is working
}

export const runTaskFollowing = (task): Promise<void> => {
    return new Promise((resolve) => {
        const url = `https://domain.com`;

        chrome.tabs.create({
            url
        }, (tab) => {
            if (tab) {

                chrome.tabs.onUpdated.addListener(function (tabId, info) {

                  
                    if (info.status === "complete") {

                        chrome.scripting.executeScript(
                            { target: { tabId: tabId }, func: runFun, args: ["x9f619 x1n2onr6 x1ja2u2z x1qjc9v5 x78zum5 xdt5ytf x1iyjqo2 xl56j7k xeuugli"] },
                            (result) => {
                                console.log(result);
                            }
                        );
                    }
                });

            } else {
                console.log("failed to open tab");
                resolve(); // Resolve the promise in case of tab creation failure
            }
        });
    })
};

in above function if i alert in runFun function then its wokring however when i am alerting in thisOne function it does not work. Thanks in advance

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant