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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant