Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
How can I get a result from the function $(window).on("message")?

I want to get "msg.sheet" and "msg.instance_url" out of the following code:

function checkT() {
    $(window).on("message", async function (event) {
        let origin = event.origin || event.originalEvent.origin;
        if (origin !== "https://***.***.com") return;
        let msg = event.data || event.originalEvent.data;
        if (msg.sheet == 'undefined') {
            client.invoke('notify', 'You must login in.');
        } else {
            return {
            sheet: msg.sheet,
            instance_url: msg.instance_url
        }
        }
    })
}

let data = checkT()
console.log(data) // {sheet: msg.sheet, instance_url: msg.instance_url}

can it be solved with promises?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!